redux-toolkit
redux-toolkit copied to clipboard
Codegen generating nullable while OpenAPI spec doesn't define nullable
The OpenAPI spec:
"TestEntityDto": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"name": {
"type": "string",
"nullable": true
},
"created": {
"type": "string",
"format": "date-time"
},
"lastModified": {
"type": "string",
"format": "date-time"
}
},
"additionalProperties": false
},
The generated type:
export type TestEntityDto = {
id?: string;
name?: string | null;
created?: string;
lastModified?: string;
};
Why is the id nullable?
It's not nullable, it's optional, because you didn't mark it as required: https://swagger.io/docs/specification/v3_0/data-models/data-types/#objects