Openapi.SchemaCompiler (Openapi v0.3.1)

Copy Markdown View Source

Compiles the JSON schemas of a single OpenAPI operation into pre-resolved ExJsonSchema schemas for use by Openapi.ValidatorPlug and Openapi.ResponseValidatorPlug.

This is called at route-generation time (from Openapi.Definition.phoenix_routes/1), so the resulting schemas are embedded directly into each route's private.openapi metadata at compile time.

For an operation, it extracts:

  • The requestBody schema for application/json content
  • All parameters entries with their schemas
  • The responses schemas per status code (for application/json content)

All $ref pointers (e.g. #/components/schemas/Pet) are resolved inline against the full definition before being passed to ExJsonSchema.Schema.resolve/1, producing self-contained, pre-resolved schemas with zero per-request overhead.

Summary

Functions

Compiles the request body, parameter, and response schemas of a single OpenAPI operation.

Functions

compile_operation(operation, definition)

Compiles the request body, parameter, and response schemas of a single OpenAPI operation.

$ref pointers are resolved against the full definition.