In OAS30, nullables are faultily converted to generic "object" type
jsamr opened this issue · comments
Jules Sam. Randolph commented
oas-raml-coverter version 1.1.35
Similar to #42.
bar2
field of FooFromBar
schema should be of schema Foo
with nullable
option set, but is instead set to "type": "object"
RAML Source
types:
Foo:
properties:
bar1: number
FooFromBar:
properties:
bar2: Foo?
Expected (oas3+json)
{
"components": {
"schemas": {
"Foo": {
"properties": {
"bar1": {
"type": "number"
}
},
"required": [
"bar1"
],
"type": "object"
},
"FooFromBar": {
"properties": {
"bar2": {
"nullable": true,
"allOf": {
"$ref": "#/components/schemas/Foo"
}
}
},
"required": [
"bar2"
],
"type": "object"
}
}
}
}
Observed (oas3+json)
{
"components": {
"schemas": {
"Foo": {
"properties": {
"bar1": {
"type": "number"
}
},
"required": [
"bar1"
],
"type": "object"
},
"FooFromBar": {
"properties": {
"bar2": {
"type": "object"
}
},
"required": [
"bar2"
],
"type": "object"
}
}
}
}
Jules Sam. Randolph commented
Full reproduction available here: https://github.com/jsamr/oas-raml-converter-missing-nullable
yingqiaoshop commented
In case the raml as:
name: string | nil
The OAS3.0 converted contains
"name": {
"oneOf": [
{
"type": "string"
},
{
"type": "nil"
}
]
},
where the expectation could be:
"name": {
"oneOf": [
{
"type": "string"
}],
nullable: true
},