Module

autodoc.extractors.openapi

OpenAPI documentation extractor.

Extracts documentation from OpenAPI 3.0/3.1 specifications.

Classes

OpenAPIExtractor
Extracts documentation from OpenAPI specifications. Supports OpenAPI 3.0 and 3.1 (YAML or JSON).
5

Extracts documentation from OpenAPI specifications.

Supports OpenAPI 3.0 and 3.1 (YAML or JSON).

Inherits from Extractor

Methods 2

extract
Extract documentation elements from OpenAPI spec file.
1 list[DocElement]
def extract(self, source: Path) -> list[DocElement]

Extract documentation elements from OpenAPI spec file.

Parameters 1
source Path

Path to openapi.yaml or openapi.json

Returns

list[DocElement]

List of DocElement objects

get_output_path
Determine output path for OpenAPI elements. Structure: - Overview: index.md - …
1 Path | None
def get_output_path(self, element: DocElement) -> Path | None

Determine output path for OpenAPI elements.

Structure:

  • Overview: index.md
  • Endpoints: endpoints/{tag}/{operation_id}.md
  • Schemas: schemas/{name}.md
Parameters 1
element DocElement
Returns

Path | None

Internal Methods 3
_extract_overview
Extract API overview information.
2 DocElement
def _extract_overview(self, spec: dict[str, Any], source: Path) -> DocElement

Extract API overview information.

Parameters 2
spec dict[str, Any]
source Path
Returns

DocElement

_extract_endpoints
Extract all path operations.
1 list[DocElement]
def _extract_endpoints(self, spec: dict[str, Any]) -> list[DocElement]

Extract all path operations.

Parameters 1
spec dict[str, Any]
Returns

list[DocElement]

_extract_schemas
Extract component schemas.
1 list[DocElement]
def _extract_schemas(self, spec: dict[str, Any]) -> list[DocElement]

Extract component schemas.

Parameters 1
spec dict[str, Any]
Returns

list[DocElement]