openapi-backend
openapi-backend copied to clipboard
Decycle produce a wrong schema for schemas with `description`
The original schema:
{
"title": "Request",
"type": "object",
"additionalProperties": true,
"properties": {
"requestBody": {
"type": "object",
"additionalProperties": false,
"properties": {
"active": {
"description": "Active style.",
"type": "object",
"additionalProperties": false,
"properties": {
"foo": {
"type": "string"
}
}
},
"default": {
"description": "Default style.",
"type": "object",
"additionalProperties": false,
"properties": {
"foo": {
"type": "string"
}
}
}
}
}
},
"required": [
"requestBody"
]
}
The decycled schema:
{
"title": "Request",
"type": "object",
"additionalProperties": true,
"properties": {
"requestBody": {
"type": "object",
"additionalProperties": false,
"properties": {
"active": {
"description": "Active style.",
"type": "object",
"additionalProperties": false,
"properties": {
"foo": {
"type": "string"
}
}
},
"default": {
"description": "Default style.",
"type": "object",
"additionalProperties": false,
"properties": {
"$ref": "#/properties/requestBody/properties/active/properties"
}
}
}
}
},
"required": [
"requestBody"
]
}
I would imagine the correct result should be something like:
{
"title": "Request",
"type": "object",
"additionalProperties": true,
"properties": {
"requestBody": {
"type": "object",
"additionalProperties": false,
"properties": {
"active": {
"type": "object",
"additionalProperties": false,
"properties": {
"foo": {
"type": "string"
}
},
"description": "Style definition."
},
"default": {
"$ref": "#/properties/requestBody/properties/active"
}
}
}
},
"required": [
"requestBody"
]
}