forked from loafle/openapi-generator-original
Ruby-client: Don't encode slashes if strict-spec false (#3204)
URL-special characters such as /,?,% should be encoded when inside path parameters. I changed the Ruby-client to do so. https://github.com/OpenAPITools/openapi-generator/pull/3039 Unfortunately, some projects relied on slashes not being expanded within path paramters: https://github.com/OpenAPITools/openapi-generator/issues/3119 With this commit, these projects can now pass `--strict-spec false` to not have / converted to %2F. strict spec not specified: / -> %2F --strict-spec true: / -> %2F --strict-spec false: / -> /
This commit is contained in:
parent
4ac33d80f0
commit
034064be4c
@ -562,6 +562,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
operation.put("classVarName", config.toApiVarName(tag));
|
||||
operation.put("importPath", config.toApiImport(tag));
|
||||
operation.put("classFilename", config.toApiFilename(tag));
|
||||
operation.put("strictSpecBehavior", config.isStrictSpecBehavior());
|
||||
|
||||
if (allModels == null || allModels.isEmpty()) {
|
||||
operation.put("hasModel", false);
|
||||
|
@ -123,7 +123,7 @@ module {{moduleName}}
|
||||
{{/hasValidation}}
|
||||
{{/allParams}}
|
||||
# resource path
|
||||
local_var_path = '{{{path}}}'{{#pathParams}}.sub('{' + '{{baseName}}' + '}', CGI.escape({{paramName}}.to_s)){{/pathParams}}
|
||||
local_var_path = '{{{path}}}'{{#pathParams}}.sub('{' + '{{baseName}}' + '}', CGI.escape({{paramName}}.to_s){{^strictSpecBehavior}}.gsub('%2F', '/'){{/strictSpecBehavior}}){{/pathParams}}
|
||||
|
||||
# query parameters
|
||||
query_params = opts[:query_params] || {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user