acacode / acacode/swagger-typescript-api
Non nullable properties are generated as possibly undefined
- Lingua principale
- TypeScript
- Stelle
- 4.1k
- Fork
- 436
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
I have an object of a product that has some non nullable properties such as ProductId and price with the following schema generated by swagger
```
"ProductBasicInfo": {
"type": "object",
"properties": {
"productId": {
"type": "integer",
"format": "int32"
},
"brand": {
"type": "string",
"nullable": true
},
"description": {
"type": "string",
"nullable": true
},
"name": {
"type": "string",
"nullable": true
},
"price": {
"type": "number",
"format": "double"
}
},
"additionalProperties": false
}
```
This is the generated contract
```
export interface ProductBasicInfo {
/** @format int32 */
productId?: number;
brand?: string | null;
description?: string | null;
name?: string | null;
/** @format double */
price?: number;
}
```
As you can see, in the generated contract a `?` was added to the non nullable properties making their type effectively `number | undefined
`
Is it possible to omit the `?` mark for non nullable types?
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.