Title: Validation of required fields inconsistent · Issue #373 · python-openapi/openapi-spec-validator · GitHub
Open Graph Title: Validation of required fields inconsistent · Issue #373 · python-openapi/openapi-spec-validator
X Title: Validation of required fields inconsistent · Issue #373 · python-openapi/openapi-spec-validator
Description: 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 required that do not exist. If you want to use it with allOf and therefore have prop...
Open Graph Description: 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 required that do not exist. If you want to u...
X Description: 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 required that do not exist. If you want to u...
Opengraph URL: https://github.com/python-openapi/openapi-spec-validator/issues/373
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Validation of required fields inconsistent","articleBody":"The validation of the `required` keyword does not make sense as it is implemented right now, IMHO.\r\n\r\n1. It really does not make any sense to list properties in `required` that do not exist.\r\n2. If you want to use it with `allOf` and therefore have properties in `required` that do not exist, there are already precautions (#154).\r\n3. Currently, there is no validation error in the standard case but as soon as I have `allOf` in my schema, there is a validation error. That is inconsistent. The PR that breaks it: #312\r\n4. In `$ref`erenced schemas, the validation does not take effect either.\r\n\r\nOne 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.\r\n\r\nIn 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.\r\n\r\nMy take on this:\r\n\r\n1. Best case: Throw validation errors for things that are obvious errors (like specifying a field as required that does not even exist).\r\n2. Second best option: make it configurable (\"strict mode\") or filterable (error IDs to exclude, filter levels, ...).\r\n3. Absolutely necessary minium: make it consistent.\r\n\r\nI'd be willing to provide a PR. But since this has been going [back ](#97) and [forth](#266) I'd like a decision first, where this is going.","author":{"url":"https://github.com/Archelyst","@type":"Person","name":"Archelyst"},"datePublished":"2024-08-09T11:01:52.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/373/openapi-spec-validator/issues/373"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:26fbaf00-cc76-078d-6116-be27f17e534a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A6A8:1D778D:51D054:73C6C7:696A513E |
| html-safe-nonce | b9f8d1e428776ed7208d6cfce3801bba99b46364c2fca1588903d56f1c6f13e8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNkE4OjFENzc4RDo1MUQwNTQ6NzNDNkM3OjY5NkE1MTNFIiwidmlzaXRvcl9pZCI6IjM0NTY1ODgwMzIzMjE5MzM2MzAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 5ca5fbe63e8c3f010b43e8214c1650aed5ec38977d3acdae314842280ba6affe |
| hovercard-subject-tag | issue:2457671438 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-openapi/openapi-spec-validator/373/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2c3544d629169aaea65e45547ed3f3232b610d6e547213c774e6397168bc9781/python-openapi/openapi-spec-validator/issues/373 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2c3544d629169aaea65e45547ed3f3232b610d6e547213c774e6397168bc9781/python-openapi/openapi-spec-validator/issues/373 |
| og:image:alt | 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 required that do not exist. If you want to u... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Archelyst |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3f871c8e07f0ae1886fa8dac284166d28b09ad5bada6476fc10b674e489788ef |
| turbo-cache-control | no-preview |
| go-import | github.com/python-openapi/openapi-spec-validator git https://github.com/python-openapi/openapi-spec-validator.git |
| octolytics-dimension-user_id | 126442889 |
| octolytics-dimension-user_login | python-openapi |
| octolytics-dimension-repository_id | 102581313 |
| octolytics-dimension-repository_nwo | python-openapi/openapi-spec-validator |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 102581313 |
| octolytics-dimension-repository_network_root_nwo | python-openapi/openapi-spec-validator |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 63c426b30d262aba269ef14c40e3c817b384cd61 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width