swagger-typescript-codegen icon indicating copy to clipboard operation
swagger-typescript-codegen copied to clipboard

Make the implementation follow the OpenAPI/Swagger spec for dictionaries

Open mtennoe opened this issue 5 years ago • 1 comments

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 avatar Mar 12 '19 07:03 mtennoe

@scottc FYI

mtennoe avatar Mar 12 '19 08:03 mtennoe