docs/python-sdk/fastmcp-utilities-openapi-json_schema_converter.mdx
fastmcp.utilities.openapi.json_schema_converterClean 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.
convert_openapi_schema_to_json_schema <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/utilities/openapi/json_schema_converter.py#L40" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>convert_openapi_schema_to_json_schema(schema: dict[str, Any], openapi_version: str | None = None, remove_read_only: bool = False, remove_write_only: bool = False, convert_one_of_to_any_of: bool = True) -> dict[str, Any]
Convert an OpenAPI schema to JSON Schema format.
This is a clean, systematic approach that:
Args:
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 anyOfReturns:
convert_schema_definitions <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/utilities/openapi/json_schema_converter.py#L324" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>convert_schema_definitions(schema_definitions: dict[str, Any] | None, openapi_version: str | None = None, **kwargs) -> dict[str, Any]
Convert a dictionary of OpenAPI schema definitions to JSON Schema.
Args:
schema_definitions: Dictionary of schema definitionsopenapi_version: OpenAPI version for optimization**kwargs: Additional arguments passed to convert_openapi_schema_to_json_schemaReturns: