readOnly property not marked as optional in the generated model
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 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 bản tái hiện OpenAPI 3.1 được cung cấp với openapi-python-client 0.22 và kiểm tra model Bug được tạo cùng cách sử dụng POST. Theo dõi nơi các trường readOnly và required được chuyển đổi; hoàn tất khi các trường readOnly không bắt buộc đối với đầu vào POST nhưng vẫn khả dụng trong các model response được tạo, kèm theo độ bao phủ hồi quy.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
Fields marked as readOnly in a schema in the OpenAPI document are not set as optional in the generated model.
This makes them required in the body of any POST request in which this model is used, defeating the purpose of using the readOnly property.
OpenAPI Spec File
openapi: 3.1.0
info:
title: Minimal bug reproduction API
version: 1.0.0
paths:
/bug:
get:
summary: Get all bugs
responses:
"200":
description: A list of bugs
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Bug"
post:
summary: Create a bug
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/Bug"
responses:
"201":
description: Bug created
content:
application/json:
schema:
$ref: "#/components/schemas/Bug"
components:
schemas:
Bug:
type: object
properties:
id:
readOnly: true
type: integer
created_at:
readOnly: true
type: string
format: date-time
name:
type: string
description:
type: string
status:
type: string
enum:
- open
- closed
required:
- id
- name
- description
- status
- created_at
Desktop (please complete the following information):
- OS: [Windows 11]
- Python Version: [3.12]
- openapi-python-client version [0.22]
- 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 ·