Skip to content

Conversation

tomtit
Copy link
Contributor

@tomtit tomtit commented Apr 22, 2015

Fixes #646: Example field handling has been fixed.
The swagger-api/swagger-core/pull/1002 has to be accepted first.

I would suggest to remove escaping of '\n' (i.e. example = example.replaceAll("\n", "\n") in ExampleGenerator and jsonExample = jsonExample.replaceAll("\n", "\n") in NodeJSServerCodegen) and leave this on behalf of particular descendants of the DefaultCodegen class.
As for now only html and nodejs generators use examples, while the first outputs examples as is and has the issue reported here, and the former handles escaped '\n' properly

Copy link
Contributor

Choose a reason for hiding this comment

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

@tomtit - notice that this broke the build

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@webron, that is why I've referenced the swagger-api/swagger-core/pull/1002 pull request. The com.wordnik.swagger.models.Response from that change is required. Just don't know how to reference the develop_2.0 branch properly.

Copy link
Contributor

Choose a reason for hiding this comment

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

Apologies, I had missed that comment. We can't depend on a SNAPSHOT here though. That means we'll have to wait until swagger-core is released and then modify this PR accordingly. Still not sure what version that's going to end up being.

Copy link
Contributor

Choose a reason for hiding this comment

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

@tomtit There is a Java generator that uses examples but the code cannot be merged back to the official repo as the generated code is in Java 8 but swagger-codegen has to be built in Java 7 container.
Here is the repo
https://github.com/networknt/swagger-codegen
And here is the petstore generated
https://github.com/networknt/light-java-example/tree/master/petstore

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.

5 participants