-
Notifications
You must be signed in to change notification settings - Fork 327
Open
Description
This type definition which has two properties that only differ in whether they are optional:
type Color = string;
export interface MyObject {
color: Color;
color2?: Color;
}
creates the following schema (with aliasRef: true
)
{
"MyObject": {
"type": "object",
"properties": {
"color": {
"$ref": "#/components/schemas/Color"
},
"color2": {
"$ref": "#/components/schemas/Color_1"
}
},
"required": [
"color"
]
},
"Color": {
"type": "string"
},
"Color_1": {
"type": "string"
}
}
In more complex cases, Color_1
will simply "$ref": "Color"
which seems completely pointless. The intermediate types have names that are invalid model names in AWS API Gateway. Therefore, I cannot use aliasRef
and basically have no way to do type aliases because all definitions are duplicated with aliasRef: false
:
{
"MyObject": {
"type": "object",
"properties": {
"color": {
"type": "string"
},
"color2": {
"type": "string"
}
},
"required": [
"color"
]
}
}
Using the latest library version 0.65.1 with Node v18.20.4.
Metadata
Metadata
Assignees
Labels
No labels