-
Notifications
You must be signed in to change notification settings - Fork 527
Description
Sorting
-
I'm submitting a ...
- bug report
- feature request
- support request
-
I confirm that I
- used the search to make sure that a similar issue hasn't already been submit
Expected Behavior
I discovered some weird issues with OpenAPI schemas when they are using "oneOf". I just want to clarify if this is an issue with tsoa or if there is a general bug with swagger's generators.
(see also swagger-api/swagger-codegen#9722)
Everything seems to work with swagger v2 : https://test.hokify.com/ats-api/swagger.yaml
But when generating the sawgger file I get the warnings of "Swagger 2.0 does not support union types beyond string literals.
If you would like to take advantage of this, please change tsoa.json's "specVersion" to 3."
So when I do that, everything looks fine, no warnings, no parsing errosr int he swagger UI console.. except that the generated clients (e.g. html2 and php) are broken. I tried to track it down, and found out that the issue lies somewhere in "oneOf" defintions (see issue 9722 in swagger-codegen for more details).
Current Behavior
The current generated openapi3 is not working correctly, unsure what's the real reason though.
Possible Solution
Output some warnings if this union type constilation is not correct, or fix oneOfs output if there is something wrong with this syntax.
Steps to Reproduce
- https://editor.swagger.io/?url=https://test.hokify.com/ats-api/openapi.yaml
- Generate Client -> HTML2 -> see that there are no schemas und you get javascript errors
- https://editor.swagger.io/?url=https://test.hokify.com/ats-api/swagger.yaml <-- same defintion just in version 2
- Generate Client -> HTML2 -> all works
same bugs appear with other clients (dynamic-html, php, ..etc).
Context (Environment)
Version of the library: 2.5.1
Version of NodeJS: 12.6.0
- Confirm you were using yarn not npm: [ ] <-- nope, I'm using npm