Skip to content

Conversation

@spr3nk3ls
Copy link
Contributor

@spr3nk3ls spr3nk3ls commented Mar 29, 2017

Some valid json expressions within a swagger.json file result in uncompilable Java code.

How to test:
Use this pom.xml and this swagger.json to generate an example swagger API client in Java.

Expected: the code generated results in compilable Java.

Result: the resulting Java does not compile, because expressions like "example": "[\"RABO23124NL\",\"RABO12345NL\"]", and "example": "\\\"[A-Z.]{1,10}\\", are escaped incorrectly.

I was unable to fix my original PR (#5234), so I created this one instead. Suggestions made on the original PR have been processed in this one.

@ePaul
Copy link
Contributor

ePaul commented Mar 29, 2017

There are no sample changes caused by this – regenerating the samples for the java projects just gives the changes which are included in my update-samples PRs #5243 and #5212.

Maybe we should have an example in one of the test YAMLs which shows the effect?

@wing328 wing328 modified the milestones: Future, v2.2.3 Mar 30, 2017
@wing328
Copy link
Contributor

wing328 commented Apr 1, 2017

@ePaul yup, we can add examples to the fake petstore spec so as to cover these cases

@wing328 wing328 merged commit bd8b2d3 into swagger-api:master Apr 23, 2017
@wing328
Copy link
Contributor

wing328 commented Apr 23, 2017

@spr3nk3ls thanks for the PR, which has been merged into master.

I'll create an issue to track updating fake petstore with examples you provided in your spec.

@spr3nk3ls spr3nk3ls deleted the feature/java_escaping_fixes branch April 25, 2017 08:48
kenjones-cisco added a commit to kenjones-cisco/swagger-codegen that referenced this pull request May 2, 2017
Applies the same fix as swagger-api#5247 to avoid invalid escaping of the attribute
example within `ApiModelProperty`.

Resolves swagger-api#5534
wing328 pushed a commit that referenced this pull request May 3, 2017
Applies the same fix as #5247 to avoid invalid escaping of the attribute
example within `ApiModelProperty`.

Resolves #5534
davidgri pushed a commit to davidgri/swagger-codegen that referenced this pull request May 11, 2017
davidgri pushed a commit to davidgri/swagger-codegen that referenced this pull request May 11, 2017
Applies the same fix as swagger-api#5247 to avoid invalid escaping of the attribute
example within `ApiModelProperty`.

Resolves swagger-api#5534
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants