acacode / acacode/swagger-typescript-api

Non nullable properties are generated as possibly undefined

オープン
#396 コメント 14 件 リアクション 23 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
4.1k
フォーク
436
PR マージ指標
30日以内にマージされた PR はありません

説明

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?

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。