Skip to content

Commit 1787804

Browse files
ccouzensautopp
authored andcommitted
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. 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: / -> /
1 parent a9bf133 commit 1787804

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

.generator/templates/api.mustache

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ module {{moduleName}}
123123
{{/hasValidation}}
124124
{{/allParams}}
125125
# resource path
126-
local_var_path = '{{{path}}}'{{#pathParams}}.sub('{' + '{{baseName}}' + '}', CGI.escape({{paramName}}.to_s)){{/pathParams}}
126+
local_var_path = '{{{path}}}'{{#pathParams}}.sub('{' + '{{baseName}}' + '}', CGI.escape({{paramName}}.to_s){{^strictSpecBehavior}}.gsub('%2F', '/'){{/strictSpecBehavior}}){{/pathParams}}
127127

128128
# query parameters
129129
query_params = opts[:query_params] || {}

0 commit comments

Comments
 (0)