acacode / acacode/swagger-typescript-api
Non nullable properties are generated as possibly undefined
- Lenguaje dominante
- TypeScript
- Estrellas
- 4.1k
- Forks
- 436
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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?
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.