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

Parameter type not supported (nullable)

Open erictuvesson opened this issue 5 years ago • 2 comments

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. 😄

erictuvesson avatar Nov 19 '19 07:11 erictuvesson

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

mtennoe avatar Nov 21 '19 06:11 mtennoe

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

erictuvesson avatar Mar 10 '20 09:03 erictuvesson