Skip to content

Fixes in escaping when generating Java from swagger.json.#5234

Closed
spr3nk3ls wants to merge 6842 commits intoswagger-api:masterfrom
spr3nk3ls:master
Closed

Fixes in escaping when generating Java from swagger.json.#5234
spr3nk3ls wants to merge 6842 commits intoswagger-api:masterfrom
spr3nk3ls:master

Conversation

@spr3nk3ls
Copy link
Copy Markdown
Contributor

Description of the PR

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.

jfiala and others added 30 commits March 1, 2017 00:20
…-api#4712)

* add language for resteasy eap swagger-api#4512

* first implementation of jaxrs-resteasy-eap swagger-api#4512

* add support for joda and java8 datetime types swagger-api#4512

* add new file JacksonConfig and new sample eap-joda swagger-api#4512

* add dynamic swagger support to jaxrs-resteasy-eap swagger-api#4512

* adapt readme for eap swagger-api#4512

* add tests for jaxrs-resteasy-eap swagger-api#4512

* cleanup tabs swagger-api#4512

* cleanup tabs swagger-api#4512

* cleanup tabs swagger-api#4512

* cleanup tabs / regenerate without joda swagger-api#4512

* regenerate with updated templates swagger-api#4512

* fix test (wrong setter invoked) swagger-api#4512

* fix test swagger-api#4512

* fix no invocation swagger-api#4512

* replace tabs with spaces swagger-api#4512
ePaul and others added 23 commits March 27, 2017 11:47
…cyfx samples (swagger-api#5209)

* Add packageGuid parameter to NancyFxServerCodegen.

* Use packageGuid parameter for nancyfx petstore samples.
…CoreServerCodegen. (swagger-api#5199)

* Issue swagger-api#5196: add packageUid parameter to AspNetCoreServerCodeGen.

* Change .bat file, too.
…pi#5210)

* Fix MSF4J pom indentation.

* Set MSF4J sample artifactId in the generator script.

* Update MSF4J samples.
* Pretty-print swagger.json.

(This was done via `jq`. In a later commit we'll generate it pretty-printed.)

* Erlang Server: pretty-print generated swagger.json.

* Update samples for Erlang-server.
…api#4820)

This change enables top level enumeratons to be written out as:

export type SortDirection = "Ascending" | "Descending";

vs.

export class SortDirection {
}
…ger-api#5231)

* Issue swagger-api#3084: Support hideGenerationTimestamp for Undertow.

* Issue swagger-api#3084: disable timestamp generation for undertow samples.

* Update samples for Undertow.
@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Mar 28, 2017

Thanks for the PR but your commit (as shown in the Commits tab) is not linked to your Github account, which means this PR won't count as your contribution in https://github.com/swagger-api/swagger-codegen/graphs/contributors.

Let me know if you need help fixing it.

Ref: https://github.com/swagger-api/swagger-codegen/wiki/FAQ#how-can-i-update-commits-that-are-not-linked-to-my-github-account

}

@Override
public Mustache.Compiler processCompiler(Mustache.Compiler compiler) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of turning it off, what about using {{{ ... }}} instead to use the unescape value?

The change will have a lot of impacts to mustache templates used by Java AP clients as well as server stubs (spring. jaxrs, play, etc)

@spr3nk3ls
Copy link
Copy Markdown
Contributor Author

I was unable to fix this PR, so I made a new one with the suggested changes. See #5247

@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Mar 29, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.