openapi-generators / openapi-generators/openapi-python-client

$ref in path parameters doesn't seem to work

Đang mở
#605 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

🐞bug
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
If a get path has a parameter using $ref to point to #/components/parameters, the generated API lacks the corresponding kwarg. If one "hoists" the indirect parameter up into the path's parameters, it works as expected.

To Reproduce
See this repo for a reproducible example.
And see this repo for the same schema without the $ref, working as expected.

Expected behavior
I expect to see the optional page kwarg in both generated APIs.

I see this in the $ref example:

def sync(
    *,
    client: Client,
) -> Optional[List[str]]:

and this in the noref example:

def sync(
    *,
    client: Client,
    page: Union[Unset, None, GetTestPage] = UNSET,
) -> Optional[List[str]]:

OpenAPI Spec File
A link to your openapi.json which produces this issue.

Desktop (please complete the following information):

  • OS: Microsoft Windows 10 Pro 10.0.19044 Build 19044
  • Python Version: 3.9.12
  • openapi-python-client version 0.11.1

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với test-schema.yaml được liên kết trong repository có thể tái lập openapi-ref-issue và chạy generator bằng phiên bản openapi-python-client được báo cáo. So sánh entry point sync được tạo với ví dụ noref, tập trung vào việc phân giải tham số $ref. Được xem là hoàn tất khi API được tạo cũng bao gồm page kwarg tùy chọn trong trường hợp tham số được tham chiếu.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
openapi, python
Lĩnh vực
api
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
48/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.