Title: Nullable `allOf`s with default `null` values fail validation · Issue #418 · python-openapi/openapi-spec-validator · GitHub
Open Graph Title: Nullable `allOf`s with default `null` values fail validation · Issue #418 · python-openapi/openapi-spec-validator
X Title: Nullable `allOf`s with default `null` values fail validation · Issue #418 · python-openapi/openapi-spec-validator
Description: Hi, In OpenAPI 3.0 it's a common pattern to represent a reference that can be null as an allOf with nullable: true. However, if you set the default to null, openapi-spec-validator attempts to validate null against the referenced schema, ...
Open Graph Description: Hi, In OpenAPI 3.0 it's a common pattern to represent a reference that can be null as an allOf with nullable: true. However, if you set the default to null, openapi-spec-validator attempts to valid...
X Description: Hi, In OpenAPI 3.0 it's a common pattern to represent a reference that can be null as an allOf with nullable: true. However, if you set the default to null, openapi-spec-validator attempts to v...
Opengraph URL: https://github.com/python-openapi/openapi-spec-validator/issues/418
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Nullable `allOf`s with default `null` values fail validation","articleBody":"Hi,\n\nIn OpenAPI 3.0 it's a common pattern to represent a reference that can be null as an `allOf` with `nullable: true`. \n\nHowever, if you set the `default` to `null`, `openapi-spec-validator` attempts to validate `null` against the referenced schema, and returns an error. The default should take into account the nullability of the schema that it's part of, not just the referenced `allOf`.\n\n```\n{\n \"info\": {\n \"title\": \"Example\",\n \"version\": \"v1\",\n },\n \"openapi\": \"3.0.2\",\n \"components\": {\n \"schemas\": {\n \"FooSchema\": {\n \"title\": \"FooSchema\",\n \"type\": \"object\"\n },\n \"BarSchema\": {\n \"allOf\": [\n {\n \"$ref\": \"#/components/schemas/FooSchema\"\n }\n ],\n \"nullable\": true,\n \"default\": null\n }\n }\n },\n \"paths\": {}\n}\n```\n\n```\nFailed validating 'type' in schema['allOf'][0]:\n {'title': 'FooSchema', 'type': 'object'}\n\nOn instance:\n None\n```","author":{"url":"https://github.com/pranjalv123","@type":"Person","name":"pranjalv123"},"datePublished":"2025-07-01T13:33:20.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/418/openapi-spec-validator/issues/418"}
| 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:d74cfeb1-8fce-7dca-fa48-5869adccc59b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B996:31622E:49AF38:68D543:696A5019 |
| html-safe-nonce | a7eace0db68146225ff4cbfcea157e8a3c8548afc812cefe818c82ea713dfe41 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOTk2OjMxNjIyRTo0OUFGMzg6NjhENTQzOjY5NkE1MDE5IiwidmlzaXRvcl9pZCI6IjU2MDk2ODcxNDgxOTc5OTA0MjUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | d94b7751cb72328e4a73b15e6ebad30a7a33e118f4a07218a031cd9dbe83eb89 |
| hovercard-subject-tag | issue:3192521300 |
| 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/418/issue_layout |
| twitter:image | https://opengraph.githubassets.com/588d28c5c844650cc6cf0f5860d835fc0c7db9cd8d8dabad76e45e49d163a297/python-openapi/openapi-spec-validator/issues/418 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/588d28c5c844650cc6cf0f5860d835fc0c7db9cd8d8dabad76e45e49d163a297/python-openapi/openapi-spec-validator/issues/418 |
| og:image:alt | Hi, In OpenAPI 3.0 it's a common pattern to represent a reference that can be null as an allOf with nullable: true. However, if you set the default to null, openapi-spec-validator attempts to valid... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pranjalv123 |
| 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