openapi-generators / openapi-generators/openapi-python-client
readOnly property not marked as optional in the generated model
オープン
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 2k
- フォーク
- 293
- 平均マージ
- 34分
- マージ済み PR(30日)
- 1
説明
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]
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、提供された OpenAPI 3.1 の再現ケースを openapi-python-client 0.22 で実行し、生成された Bug モデルと POST の使用方法を調べます。readOnly フィールドと required フィールドがどこで変換されるかを追跡します。readOnly フィールドが POST 入力では必須でなく、一方で生成されたレスポンスモデルでは引き続き利用可能になり、回帰テストのカバレッジが追加されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100