mtennoe / swagger-typescript-codegen

A Swagger Codegenerator tailored for typescript.
Apache License 2.0
140 stars 52 forks source link

Make the implementation follow the OpenAPI/Swagger spec for dictionaries #66

Open mtennoe opened 5 years ago

mtennoe commented 5 years ago

There are a few valid ways to define additionalProperties.

To define a dictionary, use type: object and use the additionalProperties keyword to specify the type of values in key/value pairs.

Instead of using an inline schema, additionalProperties can $ref another schema

If the dictionary values can be of any type (aka free-form object), use additionalProperties: true

https://swagger.io/docs/specification/data-models/dictionaries/

But might be best for the implementation to follow the OpenAPI/Swagger spec, and only allow for valid dictionary types.

Could maybe also handle some of these other invalid cases.

Originally posted by @scottc in https://github.com/mtennoe/swagger-typescript-codegen/pull/63#issuecomment-471845561

mtennoe commented 5 years ago

@scottc FYI