fastmcp/docs/python-sdk/fastmcp-utilities-openapi-parser.mdx
marvin-context-protocol[bot] d320d49107 Publish FastMCP v4.0.4 docs
2026-09-16 00:04:47 +00:00

43 lines
1.3 KiB
Text

---
title: parser
sidebarTitle: parser
---
# `fastmcp.utilities.openapi.parser`
OpenAPI parsing logic for converting OpenAPI specs to HTTPRoute objects.
## Functions
### `parse_openapi_to_http_routes` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/utilities/openapi/parser.py#L56" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
```python
parse_openapi_to_http_routes(openapi_dict: dict[str, Any]) -> list[HTTPRoute]
```
Parses an OpenAPI schema dictionary into a list of HTTPRoute objects
using the openapi-pydantic library.
Supports both OpenAPI 3.0.x and 3.1.x versions.
## Classes
### `OpenAPIParser` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/utilities/openapi/parser.py#L110" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
Unified parser for OpenAPI schemas with generic type parameters to handle both 3.0 and 3.1.
**Methods:**
#### `parse` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/utilities/openapi/parser.py#L702" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
```python
parse(self) -> list[HTTPRoute]
```
Parse the OpenAPI schema into HTTP routes.