acacode / acacode/swagger-typescript-api

additionalProperties management problem in Swagger 2

Ouverte
#343 3 commentaires 0 réactions 1 personne assignée Réclamée par @js2me Voir sur GitHub
bug
Langage dominant
TypeScript
Étoiles
4.1k
Forks
436
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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 ?

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.