openapi-generators / openapi-generators/openapi-python-client
Union[Unset, datetime.date] is not allowed in header
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 parameter name='IF-MODIFIED-SINCE' produces an error 'Union[Unset, datetime.date] is not allowed in header', which prevents the endpoint from being generated.
OpenAPI Spec File
https://docs.developers.clio.com/openapi.json
Desktop (please complete the following information):
- OS: macOS 13.4.1
- Python Version: 3.12
- openapi-python-client version: 0.15.2
Additional context
The parameter schema is:
"schema": {
"type": "string", (the format in "YYYY-MM-DD")
"format": "date" (the format defined by full-date in RFC3339)
}
The client generator is attempting to map this schema to a Python Union type, the union of Unset and datetime.date, which is not allowed or fitting in a HTTP header. Maybe string dates need to be transformed to datetime objects and vice versa? Or the date could be converted to a string before setting the header? At least that's my limited understanding of the situation.
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
Không có tệp nào trong repository hoặc test nào được nêu tên. Hãy bắt đầu bằng cách tái hiện việc sinh mã với đặc tả OpenAPI được liên kết và truy vết cách xử lý tham số header IF-MODIFIED-SINCE; kiểm tra cách các ngày dạng chuỗi được biểu diễn trong các header được sinh ra. Được xem là hoàn thành khi endpoint được sinh thành công mà không gặp lỗi Union[Unset, datetime.date], với biểu diễn cho header ngày đã được kiểm thử.
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ó
- 4/5
- Thời gian dự kiến
- 3-5 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
- 42/100