In my OpenApi I have some components schemas with required properties that refers to properties inside an inline declaration, in some of the allOf list.
These required properties are wrongly ignored and the generated model will add the optional ? to the typescript interface.
Example component schema:
"BigDecimalInclusionAttributeFilter": {
"required": ["name", "operator", "values"],
"type": "object",
"allOf": [
{
"$ref": "#/components/schemas/IFilter"
},
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"operator": {
"type": "string",
"enum": ["IN", "NOT_IN"]
},
"values": {
"type": "array",
"items": {
"type": "number"
}
}
}
}
]
},
Will generate the following model:
import { IFilter } from '../models/i-filter';
export type BigDecimalInclusionAttributeFilter = IFilter & {
'name'?: string;
'operator'?: 'IN' | 'NOT_IN';
'values'?: Array<number>;
};
The "required": ["name", "operator", "values"] are ignored, probably because the required properties are not in the properties of the object, but are inside one of the allOf objects.
I would expect the required properties to be respected and the resulting type to be something like this:
import { IFilter } from '../models/i-filter';
export type BigDecimalInclusionAttributeFilter = IFilter & {
'name': string;
'operator': 'IN' | 'NOT_IN';
'values': Array<number>;
};
Am I missing somethig?
Do you need something more?
Thanks
In my OpenApi I have some components schemas with required properties that refers to properties inside an inline declaration, in some of the allOf list.
These required properties are wrongly ignored and the generated model will add the optional ? to the typescript interface.
Example component schema:
Will generate the following model:
The
"required": ["name", "operator", "values"]are ignored, probably because the required properties are not in thepropertiesof the object, but are inside one of theallOfobjects.I would expect the required properties to be respected and the resulting type to be something like this:
Am I missing somethig?
Do you need something more?
Thanks