mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-02 21:50:55 +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 template = readTemplate(templateFile);
|
||||
Template tmpl = Mustache.compiler()
|
||||
.escapeHTML(false)
|
||||
.withLoader(new Mustache.TemplateLoader() {
|
||||
@Override
|
||||
public Reader getTemplate(String name) {
|
||||
|
@ -89,7 +89,7 @@ module {{moduleName}}
|
||||
{{/hasValidation}}
|
||||
{{/allParams}}
|
||||
# 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_params = {}
|
||||
|
@ -223,7 +223,7 @@ public class DefaultGeneratorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGenerateWithHtmlEntity() throws Exception {
|
||||
public void testGenerateRubyClientWithHtmlEntity() throws Exception {
|
||||
final File output = folder.getRoot();
|
||||
|
||||
final Swagger swagger = new SwaggerParser().read("src/test/resources/2_0/pathWithHtmlEntity.yaml");
|
||||
@ -239,6 +239,7 @@ public class DefaultGeneratorTest {
|
||||
for (File file : files) {
|
||||
if (file.getName().equals("default_api.rb")) {
|
||||
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\""));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user