swaggerize-routes
swaggerize-routes copied to clipboard
discriminator support
The swagger spec allows polymorphism using a discriminator
field. I don't think swaggerize-routes has support for this at the moment, can you confirm this is the case?
For example, say I have an api parameter specified as:
{
"name": "params",
"in": "body",
"required": true,
"schema": {
"type": "object",
"properties": {
"things": {
"type": "array",
"items": {
"$ref": "#/definitions/BaseThing"
}
}
}
}
}
and definitions specified as:
{
"definitions": {
"BaseThing": {
"type": "object",
"required": ["name", "type"],
"discriminator": "type",
"properties": {
"name": {
"type": "string",
},
"type": {
"type": "string",
}
}
},
"ChildThing": {
"type": "object",
"required": ["extra"],
"allOf": [
{
"$ref": "#/definitions/BaseThing"
},
{
"properties": {
"extra": {
"type": "string",
}
}
}
]
}
}
}
Child thing is ignored and so it's fields are disallowed by validation
Since this is once again an example of Swagger not using standard json-schema, default validation will not support it. This is one of the ongoing problems with Swagger in general.