Open
Description
Problem
Given the following smithy model:
$version: "2.0"
namespace api
use alloy#nullable
enum MyEnum {
CASE_1
CASE_2
}
structure MyDto {
@nullable
enum: MyEnum
}
We get the following openapi defintion
{
"MyDto": {
"type": "object",
"properties": {
"enum": {
"$ref": "#/components/schemas/MyEnum"
}
}
},
"MyEnum": {
"type": "string",
"enum": [
"CASE_1",
"CASE_2"
]
}
}
In the spec the nullability of the enum is missing. This happens because $ref
and nullable
are incompatible.
Proposed solution
Generate the spec using oneOf
e.g.
{
"enum": {
"oneOf": [
{ "$ref": "#/components/schemas/MyEnum" },
{ "type": "null" }
]
}
}
Metadata
Assignees
Labels
No labels