mtennoe / swagger-typescript-codegen

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

Parameter type not supported (nullable) #106

Open erictuvesson opened 4 years ago

erictuvesson commented 4 years ago

Hello,

The parameter type nullable is not supported.

Location: https://github.com/mtennoe/swagger-typescript-codegen/blob/master/src/view-data/parameter.ts#L89

parameter:

{"name":"product_code","description":"product_code","required":false,"in":"nullable","type":"string"}

It would be nice if the exception contains the failed type too, it makes it a lot easier to debug an issue like this. 😄

mtennoe commented 4 years ago

Yo, and thanks for reaching out!

The codegenerator definitely lacks nullable support, however it is currently only supporting Swagger 2.0, where nullable parameter types are not part of the spec. I.e. it is possible to add it, but that would break with the 2.0 spec, while ofc. adding some value. I am a bit uncertain what I prefer here as it's important to follow the spec. Would love to hear people's opinion (@Markionium for instance).

Either way I think we need to figure out a story to eventually support the Swagger/OpenAPI 3.0 spec, and nullable should definitely be part of that

erictuvesson commented 4 years ago

I agree it would be best to follow the Swagger 2.0 specs, one potential solution could be to add an extended version. I am not sure how many more types that are not in the Swagger 2.0 spec which could potentially be used.

Related: https://github.com/mtennoe/swagger-typescript-codegen/issues/102