openapi-generators / openapi-generators/openapi-python-client
The `deprecated` field from OpenAPI operations is parsed but not exposed to templates
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 2k
- Forks
- 293
- Ø Merge
- 34 Min.
- Gemergte PRs (30 T.)
- 1
Beschreibung
Describe the bug
The deprecated field on OpenAPI operation objects is parsed into the Operation schema model (operation.py#L31), but it is never carried over to the Endpoint dataclass that is passed to Jinja templates (openapi.py#L132-L152).
This means there is no way to check endpoint.deprecated in a custom template to conditionally emit deprecation warnings, docstring annotations, or @deprecated decorators.
The Endpoint dataclass is missing a deprecated: bool field, and the constructor at openapi.py#L419-L427 does not pass data.deprecated through.
Expected behavior
The Endpoint dataclass should include a deprecated: bool = False field, populated from data.deprecated during construction, so that templates can use {% if endpoint.deprecated %} to customize output for deprecated operations.
OpenAPI Spec File
Any spec with a deprecated operation, for example:
paths:
/example:
get:
operationId: getExample
deprecated: true
responses:
'200':
description: OK
Desktop (please complete the following information):
- OS: macOS 26.3
- Python Version: 3.9.6
- openapi-python-client version: 0.28.2
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginnen Sie mit dem Operation-Modell in openapi_python_client/schema/openapi_schema_pydantic/operation.py sowie der Endpoint-Datenklasse und ihrem Konstruktor in openapi_python_client/parser/openapi.py. Verfolgen Sie, wie die Operationsdaten den an Jinja-Templates übergebenen Endpoint erreichen, und überprüfen Sie anschließend, dass eine deprecated Operation endpoint.deprecated bereitstellt und standardmäßig auf false gesetzt ist, wenn dies nicht angegeben wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 58/100