Skip to content

Adding support for JMustache compiler customization#3582

Merged
wing328 merged 1 commit intoswagger-api:masterfrom
regga-ws:compiler-customization
Aug 16, 2016
Merged

Adding support for JMustache compiler customization#3582
wing328 merged 1 commit intoswagger-api:masterfrom
regga-ws:compiler-customization

Conversation

@regga-ws
Copy link
Contributor

Extension of the CodegenConfig interface in order to use JMustache compiler native features, such as the deactivation of HTML escaping.

My custom generator implements it like this :

@Override
public Compiler processCompiler(Compiler compiler) {
   return compiler.escapeHTML(false);
}

@wing328
Copy link
Contributor

wing328 commented Aug 15, 2016

Re:

@Override
public Compiler processCompiler(Compiler compiler) {
   return compiler.escapeHTML(false);
}

Thanks for the PR. Can you please elaborate on why you want to turn off escapeHTML?

@wing328 wing328 added this to the v2.2.2 milestone Aug 15, 2016
@regga-ws
Copy link
Contributor Author

regga-ws commented Aug 15, 2016

With escapeHTML turned on by default, special characters such as simple or double quotes will be transformed into their HTML code (respectively ' and ") by the compiler. In my case, I am using a custom codegen generator to transform descriptions from a swagger spec into an human-readable document, and I end up with visible sentences such as :

...following attributes can't be updated...
...possible values are 'ABP'...

Also, I believe that other compiler configuration features may be interesting for some developers, for example to customize delimiters in some cases.

@wing328
Copy link
Contributor

wing328 commented Aug 16, 2016

@regga-ws the change sounds reasonable to me. If you want the tag without escaping HTML special characters, you can also use {{{tag_name}}} instead of {{tag_name}}

@wing328 wing328 merged commit 9858403 into swagger-api:master Aug 16, 2016
@regga-ws regga-ws deleted the compiler-customization branch August 16, 2016 08:19
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.

2 participants