pub fn parse_openapi(content: &str) -> Result<OpenAPI, Error>Expand description
Parses OpenAPI content, supporting both 3.0.x (directly) and 3.1.x (via oas3 fallback).
This function first attempts to parse the content as OpenAPI 3.0.x using the openapiv3 crate.
If that fails, it falls back to parsing as OpenAPI 3.1.x using the oas3 crate, then attempts
to convert the result to OpenAPI 3.0.x format.
§Arguments
content- The YAML or JSON content of anOpenAPIspecification
§Returns
An OpenAPI 3.0.x structure, or an error if parsing fails
§Errors
Returns an error if:
- The content is not valid YAML
- The content is not a valid
OpenAPIspecification OpenAPI3.1 features cannot be converted to 3.0 format
§Limitations
When parsing OpenAPI 3.1.x specifications:
- Some 3.1-specific features may be lost or downgraded
- Type arrays become single types
- Webhooks are not supported
- JSON Schema 2020-12 features may not be preserved