all2md.options.openapi

Options for OpenAPI/Swagger parsing.

This module provides configuration options for parsing OpenAPI/Swagger specification documents (versions 2.0 and 3.x).

class all2md.options.openapi.OpenApiParserOptions

Bases: BaseParserOptions

Options for parsing OpenAPI/Swagger specification documents.

This dataclass contains settings specific to parsing OpenAPI specifications into AST representation, supporting both OpenAPI 3.x and Swagger 2.0 formats.

Parameters:
  • include_servers (bool, default = True) – Whether to include server information section

  • include_schemas (bool, default = True) – Whether to include schema/model definitions section

  • include_examples (bool, default = True) – Whether to include request/response examples as code blocks

  • group_by_tag (bool, default = True) – Whether to group API paths by tags. When True, paths are organized under tag headings. When False, paths are listed sequentially.

  • max_schema_depth (int, default = 3) – Maximum nesting depth for rendering schema properties. Prevents infinite recursion in circular schemas.

  • code_block_language (str, default = "json") – Language identifier for code block examples (json, yaml, etc.)

  • validate_spec (bool, default = False) – Whether to validate the OpenAPI spec using jsonschema (requires jsonschema package). When True, raises ParsingError for invalid specs.

  • include_deprecated (bool, default = True) – Whether to include deprecated operations and parameters

  • expand_refs (bool, default = True) – Whether to expand $ref references inline or keep them as links

Examples

Parse with minimal output:
>>> options = OpenApiParserOptions(
...     include_servers=False,
...     include_schemas=False
... )
Validate spec during parsing:
>>> options = OpenApiParserOptions(validate_spec=True)
include_servers: bool = True
include_schemas: bool = True
include_examples: bool = True
group_by_tag: bool = True
max_schema_depth: int = 3
code_block_language: str = 'json'
validate_spec: bool = False
include_deprecated: bool = True
expand_refs: bool = True
__init__(extract_metadata: bool = False, include_servers: bool = True, include_schemas: bool = True, include_examples: bool = True, group_by_tag: bool = True, max_schema_depth: int = 3, code_block_language: str = 'json', validate_spec: bool = False, include_deprecated: bool = True, expand_refs: bool = True) None