openapi-generators / openapi-generators/openapi-python-client
The `deprecated` field from OpenAPI operations is parsed but not exposed to templates
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 2k
- Fork
- 293
- Merge trung bình
- 34 phút
- Pull request đã merge (30 ngày)
- 1
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với model Operation trong openapi_python_client/schema/openapi_schema_pydantic/operation.py và dataclass Endpoint cùng constructor trong openapi_python_client/parser/openapi.py. Truy vết cách dữ liệu operation đến Endpoint được truyền cho các template Jinja, sau đó xác minh rằng một operation deprecated cung cấp endpoint.deprecated và mặc định là false khi không được chỉ định.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- tooling
- Loại issue
- Lỗi
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 58/100