-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
[BUG][Java][Spring] Incorrect code generation with regular expressions #8625
Comments
@jorgerod Hi! You wrote "forward slashes" in your bug description but I guess you meant "backslash". The generated code is java code where the actual Pattern is passed as a java string so the java string rules apply. |
I think it's important to distinguish between two issues here.
Take the following example:
prints
To get the regular expression |
I am open for discussions and any questions. |
Yes, got it. Java accepts only the escaped string as input for Pattern regex to be valid, else will get an compile time error. So most likely this should not an issue. |
Yes, that's my opinion, too. |
Hi I close the issue. |
Bug Report Checklist
Description
Using the java Spring generator, string regex patterns have forward slashes somehow additionally escaped, changing the meaning of the pattern.
openapi-generator version
Versions 4.3.1 and 5.0.0
OpenAPI declaration file content or URL
Generation Details
Generated line:
Expected line:
As you can see, the pattern (@pattern(regexp="^(?!\\s*$).+") ) has one slash too many and modifies the regex.
The text was updated successfully, but these errors were encountered: