issue-9509 adding support to v3. Escaping for ref defined patterns#1346
Open
evgeniimv wants to merge 4 commits intoswagger-api:masterfrom
Open
issue-9509 adding support to v3. Escaping for ref defined patterns#1346evgeniimv wants to merge 4 commits intoswagger-api:masterfrom
evgeniimv wants to merge 4 commits intoswagger-api:masterfrom
Conversation
evgeniimv
commented
May 28, 2025
| LOGGER.warn("open api utility object was not properly set."); | ||
| } else { | ||
| OpenAPIUtil.addPropertiesFromRef(this.openAPI, propertySchema, codegenProperty); | ||
| OpenAPIUtil.addPropertiesFromRef(this.openAPI, propertySchema, codegenProperty, this::toRegularExpression); |
Author
There was a problem hiding this comment.
we want to use toRegularExpression defined in child classes like AbstractJavaCodegen or TypeScriptAxiosClientCodegen.
Thus, we pass it as a Function<T,T>(UnaryOperator<String>) instead of implementing it in OpenAPIUtil
evgeniimv
commented
May 28, 2025
| CodegenProperty urlProperty = codegenModel.vars.get(0); | ||
| Assert.assertEquals(urlProperty.getName(), "url"); | ||
| //verifying java pattern is properly escaped | ||
| Assert.assertEquals(urlProperty.getPattern(), SSN_ESCAPED_PATTERN); |
Author
There was a problem hiding this comment.
so basically we verify that ^\d{3}-\d{2}-\d{4}$ pattern is transformed to ^\\d{3}-\\d{2}-\\d{4}$ when AbstractJavaCodegen is used
Author
|
@frantuma Hey Francesco, may I ask you to check this one, once you have time. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
as was already stated in swagger-api/swagger-codegen#9509
tho, it was fixed in v2 of swagger-codegen
#1100
swagger-api/swagger-codegen#12038
it remains broken for swagger v3,
This change is intended to fix it in v3 as well, since v3 swagger-codegen uses
DefaultCodegenConfigdefined in this library