acacode / acacode/swagger-typescript-api

additionalProperties management problem in Swagger 2

オープン
#343 コメント 3 件 リアクション 0 件 担当者 1 名 @js2me が担当を希望しています GitHub で見る
bug
主要言語
TypeScript
スター
4.1k
フォーク
436
PR マージ指標
30日以内にマージされた PR はありません

説明

In swagger 2, additionalProperties are very limited. They didn't support the true and {} values.
To replace this they define it like this

```
MyObject:
type: object
properties:
id:
type: string
additionalProperties:
type: object
```

It works only because in java like words String, Boolean and Numbers are Objects

in swagger 2, it must be transpiled in

```
export interface MyObject {
id?: string;
[key: string]: {}; // or [key: string]: any
}
```

but for now it is transpiled in
```
export interface MyObject {
id?: string;
}
```

result is the same If I try to transpile below code
```
MyObject:
type: object
properties:
id:
type: string
additionalProperties: {}
```

The only case the correctly works is
```
MyObject:
type: object
properties:
id:
type: string
additionalProperties: true
```

Swagger file is correctly converted with Swager.io typescript generators

Is it possible to fix it ?

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

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

評価

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

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

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