Skip to content

Commit

Permalink
Ruby-client: Don't encode slashes if strict-spec false (#3204)
Browse files Browse the repository at this point in the history
URL-special characters such as /,?,% should be encoded when inside path
parameters. I changed the Ruby-client to do so.
OpenAPITools/openapi-generator#3039

Unfortunately, some projects relied on slashes not being expanded within
path paramters:
OpenAPITools/openapi-generator#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: / -> /
  • Loading branch information
ccouzens authored and autopp committed Jun 24, 2019
1 parent 3c820e0 commit 4bd05ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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] || {}
Expand Down

0 comments on commit 4bd05ff

Please sign in to comment.