diff --git a/modules/openapi-generator/src/main/resources/ruby-client/api.mustache b/modules/openapi-generator/src/main/resources/ruby-client/api.mustache index 84833056569a2a211edc0f11033a0a084a88c0dc..c92659ff2b14400dd8ef179c313bc716021d0853 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/api.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/api.mustache @@ -3,6 +3,7 @@ =end require 'uri' +require 'cgi' module {{moduleName}} {{#operations}} @@ -123,7 +124,7 @@ module {{moduleName}} {{/hasValidation}} {{/allParams}} # resource path - local_var_path = '{{{path}}}'{{#pathParams}}.sub('{' + '{{baseName}}' + '}', {{paramName}}.to_s){{/pathParams}} + local_var_path = '{{{path}}}'{{#pathParams}}.sub('{' + '{{baseName}}' + '}', CGI.escape({{paramName}}.to_s)){{/pathParams}} # query parameters query_params = opts[:query_params] || {} diff --git a/samples/client/petstore/ruby/lib/petstore/api/another_fake_api.rb b/samples/client/petstore/ruby/lib/petstore/api/another_fake_api.rb index 2dab233d1ebd2c52a21b78d504f4d62ffb88e398..18cb328fd9a5868eef63f3a9c92b7ddd2a6d2752 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/another_fake_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/another_fake_api.rb @@ -11,6 +11,7 @@ OpenAPI Generator version: 4.0.2-SNAPSHOT =end require 'uri' +require 'cgi' module Petstore class AnotherFakeApi diff --git a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb index 6017535f5ab602950aea1d417405c42873ca5020..ce59bf605c1e9eebe01a53a1f87b266206dd6979 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb @@ -11,6 +11,7 @@ OpenAPI Generator version: 4.0.2-SNAPSHOT =end require 'uri' +require 'cgi' module Petstore class FakeApi diff --git a/samples/client/petstore/ruby/lib/petstore/api/fake_classname_tags123_api.rb b/samples/client/petstore/ruby/lib/petstore/api/fake_classname_tags123_api.rb index b392d965c690068bf96fc10f4346b3fc83953b63..13410aa52defdfbabee4cd462487a3b037130eb4 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/fake_classname_tags123_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/fake_classname_tags123_api.rb @@ -11,6 +11,7 @@ OpenAPI Generator version: 4.0.2-SNAPSHOT =end require 'uri' +require 'cgi' module Petstore class FakeClassnameTags123Api diff --git a/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb b/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb index e6869a8c52c31da784cd84d879467db59e787bd1..273affb054216c563de9cd1f81c8fbc73d44f16d 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb @@ -11,6 +11,7 @@ OpenAPI Generator version: 4.0.2-SNAPSHOT =end require 'uri' +require 'cgi' module Petstore class PetApi @@ -103,7 +104,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.delete_pet" end # resource path - local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', pet_id.to_s) + local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -290,7 +291,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.get_pet_by_id" end # resource path - local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', pet_id.to_s) + local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -414,7 +415,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.update_pet_with_form" end # resource path - local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', pet_id.to_s) + local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -480,7 +481,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.upload_file" end # resource path - local_var_path = '/pet/{petId}/uploadImage'.sub('{' + 'petId' + '}', pet_id.to_s) + local_var_path = '/pet/{petId}/uploadImage'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -552,7 +553,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'required_file' when calling PetApi.upload_file_with_required_file" end # resource path - local_var_path = '/fake/{petId}/uploadImageWithRequiredFile'.sub('{' + 'petId' + '}', pet_id.to_s) + local_var_path = '/fake/{petId}/uploadImageWithRequiredFile'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s)) # query parameters query_params = opts[:query_params] || {} diff --git a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb index f506ce63f853b491e77be5ed7b36ec11224ea763..f387db67c5a7d6a95dc83627789caa2b97130d38 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb @@ -11,6 +11,7 @@ OpenAPI Generator version: 4.0.2-SNAPSHOT =end require 'uri' +require 'cgi' module Petstore class StoreApi @@ -43,7 +44,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'order_id' when calling StoreApi.delete_order" end # resource path - local_var_path = '/store/order/{order_id}'.sub('{' + 'order_id' + '}', order_id.to_s) + local_var_path = '/store/order/{order_id}'.sub('{' + 'order_id' + '}', CGI.escape(order_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -167,7 +168,7 @@ module Petstore end # resource path - local_var_path = '/store/order/{order_id}'.sub('{' + 'order_id' + '}', order_id.to_s) + local_var_path = '/store/order/{order_id}'.sub('{' + 'order_id' + '}', CGI.escape(order_id.to_s)) # query parameters query_params = opts[:query_params] || {} diff --git a/samples/client/petstore/ruby/lib/petstore/api/user_api.rb b/samples/client/petstore/ruby/lib/petstore/api/user_api.rb index 9c2bf15a5fc0da25a68a2d0779afda9f4ee09b9a..01cb76b6da84b9c6b95258c1f212ba59ad8a90d1 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/user_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/user_api.rb @@ -11,6 +11,7 @@ OpenAPI Generator version: 4.0.2-SNAPSHOT =end require 'uri' +require 'cgi' module Petstore class UserApi @@ -219,7 +220,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'username' when calling UserApi.delete_user" end # resource path - local_var_path = '/user/{username}'.sub('{' + 'username' + '}', username.to_s) + local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -277,7 +278,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'username' when calling UserApi.get_user_by_name" end # resource path - local_var_path = '/user/{username}'.sub('{' + 'username' + '}', username.to_s) + local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -465,7 +466,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'body' when calling UserApi.update_user" end # resource path - local_var_path = '/user/{username}'.sub('{' + 'username' + '}', username.to_s) + local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s)) # query parameters query_params = opts[:query_params] || {} diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/api/another_fake_api.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/api/another_fake_api.rb index 178ab7d44022b3c62c51887261348beedbc1c5e6..ca03529892acaa9bed967c84d326f974a1eac53f 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/api/another_fake_api.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/api/another_fake_api.rb @@ -11,6 +11,7 @@ OpenAPI Generator version: 4.0.2-SNAPSHOT =end require 'uri' +require 'cgi' module Petstore class AnotherFakeApi diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/api/default_api.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/api/default_api.rb index 95de16966f277753a76016e4ff621b45d479ccf3..f944f4a91ad11726eaa5e34fa84482623c3f9780 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/api/default_api.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/api/default_api.rb @@ -11,6 +11,7 @@ OpenAPI Generator version: 4.0.2-SNAPSHOT =end require 'uri' +require 'cgi' module Petstore class DefaultApi diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/api/fake_api.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/api/fake_api.rb index c5d1d5426c243d402dbc308e4648e5723427ba25..4887add3f1cde8a5c22e477fe34ef53d20bc5473 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/api/fake_api.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/api/fake_api.rb @@ -11,6 +11,7 @@ OpenAPI Generator version: 4.0.2-SNAPSHOT =end require 'uri' +require 'cgi' module Petstore class FakeApi diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/api/fake_classname_tags123_api.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/api/fake_classname_tags123_api.rb index d979a7ea3737434c2f1e651ab2c64181f2d924a2..21a754cec9ca3a422f6583042575228f57222af5 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/api/fake_classname_tags123_api.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/api/fake_classname_tags123_api.rb @@ -11,6 +11,7 @@ OpenAPI Generator version: 4.0.2-SNAPSHOT =end require 'uri' +require 'cgi' module Petstore class FakeClassnameTags123Api diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/api/pet_api.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/api/pet_api.rb index 37a0aeee28948b81e17fe893b9288c6adf68d6b9..faeb9c5e761e9ff995f0b69339f99157793c2aad 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/api/pet_api.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/api/pet_api.rb @@ -11,6 +11,7 @@ OpenAPI Generator version: 4.0.2-SNAPSHOT =end require 'uri' +require 'cgi' module Petstore class PetApi @@ -103,7 +104,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.delete_pet" end # resource path - local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', pet_id.to_s) + local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -290,7 +291,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.get_pet_by_id" end # resource path - local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', pet_id.to_s) + local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -414,7 +415,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.update_pet_with_form" end # resource path - local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', pet_id.to_s) + local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -480,7 +481,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.upload_file" end # resource path - local_var_path = '/pet/{petId}/uploadImage'.sub('{' + 'petId' + '}', pet_id.to_s) + local_var_path = '/pet/{petId}/uploadImage'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -552,7 +553,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'required_file' when calling PetApi.upload_file_with_required_file" end # resource path - local_var_path = '/fake/{petId}/uploadImageWithRequiredFile'.sub('{' + 'petId' + '}', pet_id.to_s) + local_var_path = '/fake/{petId}/uploadImageWithRequiredFile'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s)) # query parameters query_params = opts[:query_params] || {} diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/api/store_api.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/api/store_api.rb index 6d89ff2d514036f476bbec3cb11e2bc886c21d92..d846a761f28684e11349a96367b2973160c56056 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/api/store_api.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/api/store_api.rb @@ -11,6 +11,7 @@ OpenAPI Generator version: 4.0.2-SNAPSHOT =end require 'uri' +require 'cgi' module Petstore class StoreApi @@ -43,7 +44,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'order_id' when calling StoreApi.delete_order" end # resource path - local_var_path = '/store/order/{order_id}'.sub('{' + 'order_id' + '}', order_id.to_s) + local_var_path = '/store/order/{order_id}'.sub('{' + 'order_id' + '}', CGI.escape(order_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -167,7 +168,7 @@ module Petstore end # resource path - local_var_path = '/store/order/{order_id}'.sub('{' + 'order_id' + '}', order_id.to_s) + local_var_path = '/store/order/{order_id}'.sub('{' + 'order_id' + '}', CGI.escape(order_id.to_s)) # query parameters query_params = opts[:query_params] || {} diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/api/user_api.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/api/user_api.rb index 8ae599d3425e965d1d2846398cb80e7ae33b2860..6e50fade18b2e1fd0fd7e0cb270229c49b242f0d 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/api/user_api.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/api/user_api.rb @@ -11,6 +11,7 @@ OpenAPI Generator version: 4.0.2-SNAPSHOT =end require 'uri' +require 'cgi' module Petstore class UserApi @@ -225,7 +226,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'username' when calling UserApi.delete_user" end # resource path - local_var_path = '/user/{username}'.sub('{' + 'username' + '}', username.to_s) + local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -283,7 +284,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'username' when calling UserApi.get_user_by_name" end # resource path - local_var_path = '/user/{username}'.sub('{' + 'username' + '}', username.to_s) + local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -471,7 +472,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'user' when calling UserApi.update_user" end # resource path - local_var_path = '/user/{username}'.sub('{' + 'username' + '}', username.to_s) + local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s)) # query parameters query_params = opts[:query_params] || {}