Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork70
Open
Description
Hi,
In OpenAPI 3.0 it's a common pattern to represent a reference that can be null as anallOf
withnullable: true
.
However, if you set thedefault
tonull
,openapi-spec-validator
attempts to validatenull
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 referencedallOf
.
{ "info": { "title": "Example", "version": "v1", }, "openapi": "3.0.2", "components": { "schemas": { "FooSchema": { "title": "FooSchema", "type": "object" }, "BarSchema": { "allOf": [ { "$ref": "#/components/schemas/FooSchema" } ], "nullable": true, "default": null } } }, "paths": {}}
Failed validating 'type' in schema['allOf'][0]: {'title': 'FooSchema', 'type': 'object'}On instance: None
Metadata
Metadata
Assignees
Labels
No labels