-
-
Notifications
You must be signed in to change notification settings - Fork 576
Transform recursively, without JSON.parse() #223
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
Conversation
// 3. open nullable | ||
if (value.nullable) { | ||
output += "("; | ||
} |
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.
cc @antonk52 sorry about doing this for you, but your PR pointed a flaw in the design. And I wanted to make sure I was solving for nullable
(and it seems to be!).
So this doesn’t break, and it looks correct, but I actually didn’t add robust unit tests in this PR which we desperately need to ensure that nullable
works in all cases. Are nullable tests (and potentially fixing some edge cases) something you’re interested in writing in a followup PR? 👍 / 👎 ?
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.
No worries man, whatever gets the job done =)
IMHO I think the existing cases covered the nullable fairly well. If you can point out a few extra test cases where the explicit test cases are needed I have no problem sending a pr later on
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.
Yeah, fair. Thanks for understanding.
Also, a new version is up on npm with the changes, so I’d love to see if the new @next
version works for your schemas :)
shipDate?: string | ||
/** | ||
* Order Status | ||
*/ |
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.
This PR adds comment support! 🎉
| "individual" | ||
| "non_profit"; | ||
| ("company" | "government_entity" | "individual" | "non_profit") | ||
| null; |
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.
I believe nullable
has been added, but we can’t be sure before we write unit tests.
Ditches the
JSON.parse()
approach which was limiting in 2 major ways:nullable
support (Support Swagger v3 #112)At the end of the day, TypeScript isn’t JSON 🤷. And it turns out the original codebase was closer to what it needed to be. This PR refactors the output generation a little to be even simpler than before.