Allow "required" list to have undefined properties
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 35/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 技術堆疊
- openapi, python
- 領域
- api, testing-qa
研究方向
Start in openapi_spec_validator/validators.py around the require_properties argument and the linked validation block, then read tests/integration/test_validators.py around the existing case. Check the relevant OpenAPI and JSON Schema behavior before deciding the expected result; done means the validator and integration tests consistently accept or reject the undefined required properties case.
由索引模型根據 Issue 內容生成。
描述
I think requiring property names listed in required to be defined in properties is too strict. I also couldn't find this requirement in the JSON Schema or OpenAPI specs. JSON Schema validators and the Swagger Editor are fine with property names listed in required that are not defined in properties.
It makes sense to list required properties without defining them in properties when using allOf where one sub-schema requires some properties but does not specify them while another sub-schema only provides the specifications of the properties (possibly even without stating which ones are required and which ones aren't). This is especially useful when referencing and merging schema definitions or when expressing discriminated unions with some properties that are common to all union members.
I suggest to remove the following code block
and the require_properties argument:
I have seen the test case
but it also seems to be valid to express this schema like this:
{
'Credit': {
'type': 'object',
'properties': {
'clientId': {'type': 'string'},
}
},
'CreditCreate': {
'type': 'object',
'required': ['clientId'],
'allOf': [
{
'$ref': '#/components/schemas/Credit'
},
# possibly more schemas to merge ...
]
}
}
Or did I miss this rule somewhere in the spec?
- 主要語言
- Python
- 星號
- 409
- 分支
- 73
- PR 合併指標
- 30 天內沒有已合併 PR
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
python-openapi/openapi-spec-validator 的其他 Issue
-
難度 4/5 3-5 天 新手友好度 55/100
-
難度 3/5 1-2 天 新手友好度 55/100
-
難度 3/5 1-2 天 新手友好度 30/100
-
難度 4/5 3-5 天 新手友好度 42/100
python-openapi/openapi-spec-validator#400 · 1 則留言 ·
-
kind/bug/confirmed
難度 5/5 一週以上 新手友好度 25/100
python-openapi/openapi-spec-validator#373 · 1 則留言 ·
查看 python-openapi/openapi-spec-validator 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 78/100
syfoud/Simulated_Scepter#172 ·
-
A cancelled tests run makes the coverage comment workflow fail and reports it as a red check on main 未關閉area: ci bug perceived difficulty: 3
難度 2/5 1-3 小時 新手友好度 78/100
Nitjsefnie-Harness-Commons/daedalus#921 · 1 則留言 ·
-
難度 2/5 1-3 小時 新手友好度 86/100
EleutherAI/lm-evaluation-harness#4207 ·
-
難度 1/5 1 小時以內 新手友好度 92/100
-
難度 2/5 1-3 小時 新手友好度 78/100
ClickHouse/clickhouse-connect#1057 ·