acacode / acacode/swagger-typescript-api

additionalProperties management problem in Swagger 2

未關閉
#343 3 則留言 0 個 reaction 已指派 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 摘要。