Model Composition with ‘allOf’ Is Missing Fields
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 42/100
Hướng nghiên cứu
Bắt đầu bằng cách chạy đặc tả OpenAPI được cung cấp và so sánh các model Network và Base được tạo ra cùng với signature của sync_detailed. Truy vết cách các schema allOf được xử lý trong quá trình tạo model và endpoint. Công việc được xem là hoàn tất khi Network được tạo với cả hai field, endpoint sử dụng Network thay vì Base và một regression test bao quát composition này.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
Using a composition model (https://spec.openapis.org/oas/v3.0.4.html#models-with-composition) does not generate the target type but only the underlying type. For a type A which consists of the fields of B and some additional fields, only B is generated. Furthermore, A is replaced by B.
The spec below generates the following function:
def sync_detailed(
*,
client: AuthenticatedClient | Client,
body: Base,
) -> Response[Any]: ...
I would expect that the model Network is generated and used instead of Base. The Network model should include the field of Base and the field non_base_field.
OpenAPI Spec File
openapi: 3.0.0
info:
title: Service
version: 0.0.0
paths:
/widgets:
get:
responses:
"200":
description: The request has succeeded.
content:
application/json:
schema:
nullable: true
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/Network"
components:
schemas:
Base:
type: object
required:
- base_field
properties:
base_field:
type: string
Network:
type: object
required:
- non_base_field
properties:
non_base_field:
type: string
allOf:
- $ref: "#/components/schemas/Base"
Desktop (please complete the following information):
- OS: Linux
- Python Version: 3.13.11
- openapi-python-client version: 0.28.1
Additional context
Add any other context about the problem here.
- Ngôn ngữ chính
- Python
- Star
- 2k
- Fork
- 293
- Merge trung bình
- 34 phút
- Pull request đã merge (30 ngày)
- 1
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.
Issue khác của openapi-generators/openapi-python-client
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
openapi-generators/openapi-python-client#1451 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 52/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 64/100
openapi-generators/openapi-python-client#1435 · 1 bình luận ·
Tất cả issue của openapi-generators/openapi-python-client
Issue tương tự
-
🐛 Bug 🔔 Pending processing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
jumpserver/jumpserver#17584 ·
-
link-check link-check:sphinx-theme
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
OpenHands/extensions#626 · 1 bình luận ·
-
Change observation tooltip text Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
CSCfi/sd-search-api#39 ·