-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a hint for allowed values types #246
Conversation
Hmm, I found a potential caveat with approach:
From https://swagger.io/docs/specification/data-models/enums/ Unbelievable. I don't understand why. Also I have this exact issue in one of the specs I'm testing against (Soundcloud): access:
type: string
nullable: true
description: |
Level of access the user (logged in or anonymous) has to the track.
* `playable` - user is allowed to listen to a full track.
* `preview` - user is allowed to preview a track, meaning a snippet is available
* `blocked` - user can only see the metadata of a track, no streaming is possible
enum:
- playable
- preview
- blocked
- null |
As far as I can tell, almost nobody adds "null" to their enums and just use |
Good catch. I think this is what we get if we change it to |
This should take care of the problem you uncovered: #247 |
Since in JavaScript everything is nullable, this is fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for submitting (again) and catching the null string issue so fast!
Thanks! I updated to the latest OpenAPIKit version and it now works as expected. I also just made my tool public - https://github.com/kean/CreateAPI. I hope to release it soon too. |
Congrats! I haven't dug in more than the README yet, but that's a powerful sales pitch. Very exciting project! You absolutely don't need to convince me of anything, but how would you compare your goals for CreateAPI to the execution of the SwagGen project as of now? |
The main difference is execution. I've tried multiple code generators, not just SwagGen. They all produced code that doesn't compile. I tested with the GitHub spec as an input - that's the primary spec I'm optimizing for. So that's already not hard to beat. But I go way beyond just making sure the code compiles. |
Cherry-pick of #245 🍒