Skip to content

Tech debt: Extract OpenAPI schema generation from Route #8097

@leandrodamascena

Description

@leandrodamascena

Why is this needed?

Route._get_openapi_path() is 158 lines with deeply nested branches. All the schema generation logic can move to a dedicated class (e.g. RouteSchemaGenerator) that receives a Route and produces the OpenAPI path spec. The Route class drops from 662 to ~400 lines.

Which area does this relate to?

Event Handler - REST API

Suggestion

  1. Create openapi/schema_generator.py with a class that takes a Route
  2. Move _get_openapi_path, _openapi_operation_metadata, _openapi_operation_parameters, _openapi_operation_request_body, _openapi_operation_return to the new class
  3. Route delegates to the generator
  4. No public API changes

Acknowledgment

Metadata

Metadata

Projects

Status

Triage

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions