Describe the bug default property sibling to a $ref is ignored. OAS 3.1.X relies on JSON Schema 2020-12 which does not include the requirement that sibling properties to $ref should be ignored.
OpenAPI Spec File
{ "openapi": "3.1.0", "info": { "title": "title", "summary": "summary", "description": "description", "version": "0.0.1" }, "paths": { "/": { "get": { "parameters": [ { "name": "default_lost1", "required": false, "schema": { "$ref": "#/components/schemas/String", "default": "lost" } }, { "name": "default_lost2", "required": false, "schema": { "$ref": "#/components/schemas/DefaultString" } }, { "name": "default_lost3", "schema": { "allOf": [ { "$ref": "#/components/schemas/DefaultString" } ] } }, { "name": "default_kept", "schema": { "allOf": [ { "$ref": "#/components/schemas/String" } ], "default": "kept" } } ], "responses": { "200": { "description": "Successful Response", "content": {} } } } } }, "components": { "schemas": { "String": { "type": "string" }, "DefaultString": { "type": "string", "default": "component_default" } } } }
Desktop (please complete the following information):
Additional context The previous schema generates code like this:
def _get_kwargs( *, body: Object, default_lost1: str | Unset = UNSET, default_lost2: str | Unset = UNSET, default_lost3: str | Unset = UNSET, default_kept: str | Unset = 'kept', ) -> dict[str, Any]:
I would expect all defaults to be kept.
If anything else is needed I will be more than happy to provide it. Thank you for your time!
Activity