Validation of required fields inconsistent
還沒有人認領這個 Issue。
評估
- 難度
- 5/5
- 預估耗時
- 一週以上
- 新手友好度
- 25/100
- Issue 類型
- 缺陷
- 描述清晰度
- 需要釐清
- 活躍度
- 停滯
- 技術堆疊
- python
- 領域
- api, testing-qa
研究方向
The issue names no files or tests. First read the linked discussions and referenced issues #154, #312, #97, and #266 to determine the intended required-field validation policy, then locate the corresponding validator and tests. Done means the project has a decided, consistent behavior for standard, allOf, and referenced schemas, with coverage for that behavior.
由索引模型根據 Issue 內容生成。
描述
The validation of the required keyword does not make sense as it is implemented right now, IMHO.
- It really does not make any sense to list properties in
requiredthat do not exist. - If you want to use it with
allOfand therefore have properties inrequiredthat do not exist, there are already precautions (#154). - Currently, there is no validation error in the standard case but as soon as I have
allOfin my schema, there is a validation error. That is inconsistent. The PR that breaks it: #312 - In
$referenced schemas, the validation does not take effect either.
One of the main reasons why this should urgently be validated (as was in version 0.7.0) is that validators (that use the specification to validate requests/responses) will fail if there is e.g. a typo in one of the entries in required. And now there is no way to detect that.
In general, the OpenAPI/JsonSchema specification is quite relaxed. If only the bare minimum should be validated, this is probably not the only validation that can basically be removed completely.
My take on this:
- Best case: Throw validation errors for things that are obvious errors (like specifying a field as required that does not even exist).
- Second best option: make it configurable ("strict mode") or filterable (error IDs to exclude, filter levels, ...).
- Absolutely necessary minium: make it consistent.
I'd be willing to provide a PR. But since this has been going back and forth I'd like a decision first, where this is going.
- 主要語言
- 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 則留言 ·
-
難度 3/5 1-2 天 新手友好度 45/100
查看 python-openapi/openapi-spec-validator 的全部 Issue
相似的 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 82/100
-
難度 2/5 1-3 小時 新手友好度 88/100
use-agent-os/agent-os#3314 ·
-
難度 2/5 1-3 小時 新手友好度 75/100
BasedHardware/omi#15662 · 1 則留言 ·
-
documentation help wanted
難度 2/5 1-3 小時 新手友好度 90/100
-
難度 2/5 1-3 小時 新手友好度 62/100
AiursoftWeb/AnduinOS-2#19 ·