diff --git a/modules/swagger-codegen/src/main/resources/ruby/api_client.mustache b/modules/swagger-codegen/src/main/resources/ruby/api_client.mustache index 7fa611e3744..cf03f368075 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/api_client.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/api_client.mustache @@ -129,7 +129,7 @@ module {{moduleName}} # @param [String] mime MIME # @return [Boolean] True if the MIME is application/json def json_mime?(mime) - (mime == "*/*") || !(mime =~ /\Aapplication\/json(;.*)?\z/i).nil? + (mime == "*/*") || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? end # Deserialize the response to the given return type. diff --git a/samples/client/petstore-security-test/ruby/spec/api_client_spec.rb b/samples/client/petstore-security-test/ruby/spec/api_client_spec.rb index a871ed7979e..af7258be6ed 100644 --- a/samples/client/petstore-security-test/ruby/spec/api_client_spec.rb +++ b/samples/client/petstore-security-test/ruby/spec/api_client_spec.rb @@ -179,6 +179,7 @@ describe Petstore::ApiClient do expect(api_client.json_mime?('')).to eq false expect(api_client.json_mime?('application/json')).to eq true + expect(api_client.json_mime?('application/api.vnd+json')).to eq true expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true expect(api_client.json_mime?('APPLICATION/JSON')).to eq true 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 481004db585..403705d2746 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb @@ -145,20 +145,20 @@ module Petstore # verify the required parameter 'byte' is set fail ArgumentError, "Missing the required parameter 'byte' when calling FakeApi.test_endpoint_parameters" if byte.nil? - if !opts[:'integer'].nil? && opts[:'integer'] > 100.0 - fail ArgumentError, 'invalid value for "opts[:"integer"]" when calling FakeApi.test_endpoint_parameters, must be smaller than or equal to 100.0.' + if !opts[:'integer'].nil? && opts[:'integer'] > 100 + fail ArgumentError, 'invalid value for "opts[:"integer"]" when calling FakeApi.test_endpoint_parameters, must be smaller than or equal to 100.' end - if !opts[:'integer'].nil? && opts[:'integer'] < 10.0 - fail ArgumentError, 'invalid value for "opts[:"integer"]" when calling FakeApi.test_endpoint_parameters, must be greater than or equal to 10.0.' + if !opts[:'integer'].nil? && opts[:'integer'] < 10 + fail ArgumentError, 'invalid value for "opts[:"integer"]" when calling FakeApi.test_endpoint_parameters, must be greater than or equal to 10.' end - if !opts[:'int32'].nil? && opts[:'int32'] > 200.0 - fail ArgumentError, 'invalid value for "opts[:"int32"]" when calling FakeApi.test_endpoint_parameters, must be smaller than or equal to 200.0.' + if !opts[:'int32'].nil? && opts[:'int32'] > 200 + fail ArgumentError, 'invalid value for "opts[:"int32"]" when calling FakeApi.test_endpoint_parameters, must be smaller than or equal to 200.' end - if !opts[:'int32'].nil? && opts[:'int32'] < 20.0 - fail ArgumentError, 'invalid value for "opts[:"int32"]" when calling FakeApi.test_endpoint_parameters, must be greater than or equal to 20.0.' + if !opts[:'int32'].nil? && opts[:'int32'] < 20 + fail ArgumentError, 'invalid value for "opts[:"int32"]" when calling FakeApi.test_endpoint_parameters, must be greater than or equal to 20.' end if !opts[:'float'].nil? && opts[:'float'] > 987.6 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 39d5490b787..30e2a46dfac 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb @@ -137,12 +137,12 @@ module Petstore end # verify the required parameter 'order_id' is set fail ArgumentError, "Missing the required parameter 'order_id' when calling StoreApi.get_order_by_id" if order_id.nil? - if order_id > 5.0 - fail ArgumentError, 'invalid value for "order_id" when calling StoreApi.get_order_by_id, must be smaller than or equal to 5.0.' + if order_id > 5 + fail ArgumentError, 'invalid value for "order_id" when calling StoreApi.get_order_by_id, must be smaller than or equal to 5.' end - if order_id < 1.0 - fail ArgumentError, 'invalid value for "order_id" when calling StoreApi.get_order_by_id, must be greater than or equal to 1.0.' + if order_id < 1 + fail ArgumentError, 'invalid value for "order_id" when calling StoreApi.get_order_by_id, must be greater than or equal to 1.' end # resource path diff --git a/samples/client/petstore/ruby/lib/petstore/api_client.rb b/samples/client/petstore/ruby/lib/petstore/api_client.rb index df2f05d0b64..99b2f1556f4 100644 --- a/samples/client/petstore/ruby/lib/petstore/api_client.rb +++ b/samples/client/petstore/ruby/lib/petstore/api_client.rb @@ -134,7 +134,7 @@ module Petstore # @param [String] mime MIME # @return [Boolean] True if the MIME is application/json def json_mime?(mime) - (mime == "*/*") || !(mime =~ /\Aapplication\/json(;.*)?\z/i).nil? + (mime == "*/*") || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? end # Deserialize the response to the given return type.