Wrong OAS30 object type definition which faultily inherits from string
jsamr opened this issue · comments
oas-raml-coverter version 1.1.35
The OAS parser used by ReDoc project complains about a forbidden definition:
Error: Incompatible types in allOf at "#/components/schemas/BarFromFoo"
BarFromFoo
should not be of "type": "string"
Raml definition
types:
Foo:
type: object
BarFromFoo:
type: Foo
properties:
foo: string
Expected output
{
"components": {
"schemas": {
"Foo": {
"type": "object"
},
"BarFromFoo": {
"allOf": [
{
"$ref": "#/components/schemas/Foo"
},
{
"properties": {
"foo": {
"type": "string"
}
},
"type": "object"
}
]
}
}
}
}
Observed output
{
"components": {
"schemas": {
"Foo": {
"type": "object"
},
"BarFromFoo": {
"allOf": [
{
"$ref": "#/components/schemas/Foo"
},
{
"properties": {
"foo": {
"type": "string"
}
},
"type": "object"
}
],
"type": "string"
}
}
}
}
Full reproduction available here: https://github.com/jsamr/oas-raml-converter-wrongly-inherits-string
According to the OpenAPI 3.0 specification, for allOf, anyOf, oneOf keywords, there is no need to have the definition on type. So, maybe, one solution is just not to generate "type:" when those keywords are generated.