fastmcp.utilities.openapi.json_schema_converter
Clean OpenAPI 3.0 to JSON Schema converter for the experimental parser.
This module provides a systematic approach to converting OpenAPI 3.0 schemas
to JSON Schema, inspired by py-openapi-schema-to-json-schema but optimized
for our specific use case.
Functions
convert_openapi_schema_to_json_schema
- Removes OpenAPI-specific fields
- Converts nullable fields to type arrays (for OpenAPI 3.0 only)
- Converts oneOf to anyOf for overlapping union handling
- Recursively processes nested schemas
- Optionally removes readOnly/writeOnly properties
schema: OpenAPI schema dictionaryopenapi_version: OpenAPI version for optimizationremove_read_only: Whether to remove readOnly propertiesremove_write_only: Whether to remove writeOnly propertiesconvert_one_of_to_any_of: Whether to convert oneOf to anyOf
- JSON Schema-compatible dictionary
convert_schema_definitions
schema_definitions: Dictionary of schema definitionsopenapi_version: OpenAPI version for optimization**kwargs: Additional arguments passed to convert_openapi_schema_to_json_schema
- Dictionary of converted schema definitions

