Prerequisites
Fastify version
5.2
Plugin version
5.2.0
Node.js version
22.9
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
debian 12
Description
Schemas using model inheritance are not working correctly.
This schema
{
"swagger": "2.0",
"info": {
"version": "9.4.0",
"title": "@fastify/swagger"
},
"definitions": {
"def-0": {
"type": "object",
"properties": {
"parent": {
"type": "string"
}
},
"required": [
"parent"
],
"title": "schema:parent"
},
"def-1": {
"$ref": "#/definitions/def-0",
"type": "object",
"properties": {
"child": {
"type": "string"
}
},
"required": [
"child"
],
"unevaluatedProperties": false,
"title": "schema:child"
}
},
"paths": {
"/parent": {
"get": {
"responses": {
"200": {
"description": "Default Response",
"schema": {
"$ref": "#/definitions/def-0"
}
}
}
}
},
"/child": {
"get": {
"responses": {
"200": {
"description": "Default Response",
"schema": {
"$ref": "#/definitions/def-1"
}
}
}
}
}
}
}
Will not render correctly in the UI
Link to code that reproduces the bug
https://github.com/mikaelkaron/json-schema-inherit-error/tree/fastify
Expected Behavior
Schema inheritance to work as expected
Prerequisites
Fastify version
5.2
Plugin version
5.2.0
Node.js version
22.9
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
debian 12
Description
Schemas using model inheritance are not working correctly.
This schema
{ "swagger": "2.0", "info": { "version": "9.4.0", "title": "@fastify/swagger" }, "definitions": { "def-0": { "type": "object", "properties": { "parent": { "type": "string" } }, "required": [ "parent" ], "title": "schema:parent" }, "def-1": { "$ref": "#/definitions/def-0", "type": "object", "properties": { "child": { "type": "string" } }, "required": [ "child" ], "unevaluatedProperties": false, "title": "schema:child" } }, "paths": { "/parent": { "get": { "responses": { "200": { "description": "Default Response", "schema": { "$ref": "#/definitions/def-0" } } } } }, "/child": { "get": { "responses": { "200": { "description": "Default Response", "schema": { "$ref": "#/definitions/def-1" } } } } } } }Will not render correctly in the UI
Link to code that reproduces the bug
https://github.com/mikaelkaron/json-schema-inherit-error/tree/fastify
Expected Behavior
Schema inheritance to work as expected