Skip to main content

to_openapi_components

Function to_openapi_components 

Source
pub fn to_openapi_components(graph: &SchemaGraph, ty: &SchemaType) -> Value
Expand description

Render (graph, ty) to an OpenAPI 3.1 schema bundle.

The returned object has shape:

{
  "components": { "schemas": { "<TypeId>": {…}, … } },
  "root": { … the root schema … }
}

$ref pointers inside the schemas point at #/components/schemas/<TypeId> (rewritten from #/$defs/<TypeId>). OpenAPI does not accept the JSON Schema $schema keyword, so it is never emitted here.