mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-03 06:00:52 +00:00
Move path unescaping from DefaultGenerator to Ruby api template.
This commit is contained in:
parent
344e1b12e4
commit
b6eb81cbef
@ -631,7 +631,6 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
|||||||
String templateFile = getFullTemplateFile(config, templateName);
|
String templateFile = getFullTemplateFile(config, templateName);
|
||||||
String template = readTemplate(templateFile);
|
String template = readTemplate(templateFile);
|
||||||
Template tmpl = Mustache.compiler()
|
Template tmpl = Mustache.compiler()
|
||||||
.escapeHTML(false)
|
|
||||||
.withLoader(new Mustache.TemplateLoader() {
|
.withLoader(new Mustache.TemplateLoader() {
|
||||||
@Override
|
@Override
|
||||||
public Reader getTemplate(String name) {
|
public Reader getTemplate(String name) {
|
||||||
|
@ -89,7 +89,7 @@ module {{moduleName}}
|
|||||||
{{/hasValidation}}
|
{{/hasValidation}}
|
||||||
{{/allParams}}
|
{{/allParams}}
|
||||||
# resource path
|
# resource path
|
||||||
local_var_path = "{{path}}".sub('{format}','json'){{#pathParams}}.sub('{' + '{{baseName}}' + '}', {{paramName}}.to_s){{/pathParams}}
|
local_var_path = "{{{path}}}".sub('{format}','json'){{#pathParams}}.sub('{' + '{{baseName}}' + '}', {{paramName}}.to_s){{/pathParams}}
|
||||||
|
|
||||||
# query parameters
|
# query parameters
|
||||||
query_params = {}
|
query_params = {}
|
||||||
|
@ -223,7 +223,7 @@ public class DefaultGeneratorTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGenerateWithHtmlEntity() throws Exception {
|
public void testGenerateRubyClientWithHtmlEntity() throws Exception {
|
||||||
final File output = folder.getRoot();
|
final File output = folder.getRoot();
|
||||||
|
|
||||||
final Swagger swagger = new SwaggerParser().read("src/test/resources/2_0/pathWithHtmlEntity.yaml");
|
final Swagger swagger = new SwaggerParser().read("src/test/resources/2_0/pathWithHtmlEntity.yaml");
|
||||||
@ -239,6 +239,7 @@ public class DefaultGeneratorTest {
|
|||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
if (file.getName().equals("default_api.rb")) {
|
if (file.getName().equals("default_api.rb")) {
|
||||||
apiFileGenerated = true;
|
apiFileGenerated = true;
|
||||||
|
// Ruby client should set the path unescaped in the api file
|
||||||
assertTrue(FileUtils.readFileToString(file, StandardCharsets.UTF_8).contains("local_var_path = \"/foo=bar\""));
|
assertTrue(FileUtils.readFileToString(file, StandardCharsets.UTF_8).contains("local_var_path = \"/foo=bar\""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user