openapi-generators / openapi-generators/openapi-python-client
Minor schema validation error: doesn't complain about invalid default for null and file types
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
NoneProperty.build and FileProperty.build do have logic to detect if a default other than None was provided for a null property, or if any default was provided for a binary string—and we do have unit tests for those. However, in reality NoneProperty.build and FileProperty.build do not actually get called, because property_from_data just calls the initializers directly instead. Therefore if you do something like this, the default is simply ignored.
OpenAPI Spec File
components:
schemas:
MyModel:
properties:
myNullProperty:
type: "null"
default: "definitely not null"
myBinaryString:
type: string
format: binary
default: "???"
Desktop (please complete the following information):
- OS: any
- Python Version: any
- openapi-python-client version: 0.21.6
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 bằng cách lần theo property_from_data và so sánh các lệnh gọi trực tiếp đến initializer của nó với NoneProperty.build và FileProperty.build, vốn đã chứa logic validation. Chạy các unit test hiện có cho các builder đó, sau đó bổ sung coverage cho thấy các giá trị mặc định không hợp lệ trong các OpenAPI schema được cung cấp bị từ chối thay vì bị bỏ qua.
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
- api, 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