-
Notifications
You must be signed in to change notification settings - Fork 48
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
Simple pattern support + integer ranges #106
Conversation
@joennlae Thanks for your contribution! Sorry for not replying to you in time, and I will review the code later today |
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.
Overall look great to me. Thanks for your contribution!
@@ -652,6 +654,122 @@ std::string JSONSchemaConverter::VisitAny( | |||
kBasicArray + " | " + kBasicObject; | |||
} | |||
|
|||
std::string generateRangeRegex(std::optional<int> start, std::optional<int> end) { |
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.
Could you make generateRangeRegex a static member function of JSONSchemaConverter, and follow the naming conversion (GenerateRangeRegex)?
std::string converted_regex = RegexToEBNF(range_regex, false); | ||
return converted_regex; // not " " for numbers | ||
} | ||
} catch (const std::exception& e) { |
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.
Please remove the usage of try-catch block and std::exception. The reason is we maintain a typescript binding running in WASM, which has not supported exceptions yet. Just throw an error at the error line.
We can merge this PR now, and I will update according to the above comments in a new PR. Thanks @joennlae! |
This PR updates the changes in #106. It removes the try-catch block, and make GenerateRangeRegex a static member function.
This PR introduces simple regex pattern support + integer ranges.