From 5f6924a5fb05a879ab96eeb18cba17af651ba8f2 Mon Sep 17 00:00:00 2001 From: Roman Black Date: Tue, 6 Jul 2021 18:05:54 -0500 Subject: [PATCH 1/4] rubypatch --- .../src/main/resources/ruby-client/api_client.mustache | 2 +- samples/client/petstore/ruby-faraday/lib/petstore/api_client.rb | 2 +- samples/client/petstore/ruby/lib/petstore/api_client.rb | 2 +- .../ruby-client/lib/x_auth_id_alias/api_client.rb | 2 +- .../dynamic-servers/ruby/lib/dynamic_servers/api_client.rb | 2 +- .../ruby-client/lib/petstore/api_client.rb | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/ruby-client/api_client.mustache b/modules/openapi-generator/src/main/resources/ruby-client/api_client.mustache index 2741a73794ed..0f04e9303ba3 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/api_client.mustache @@ -210,7 +210,7 @@ module {{moduleName}} # @return [String] the Content-Type header (e.g. application/json) def select_header_content_type(content_types) # use application/json by default - return 'application/json' if content_types.nil? || content_types.empty? + return 'application/json' if !content_types.nil? || !content_types.empty? # use JSON when present, otherwise use the first one json_content_type = content_types.find { |s| json_mime?(s) } json_content_type || content_types.first diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api_client.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api_client.rb index c50394c22f26..bf723c8bc5cf 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api_client.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api_client.rb @@ -341,7 +341,7 @@ def select_header_accept(accepts) # @return [String] the Content-Type header (e.g. application/json) def select_header_content_type(content_types) # use application/json by default - return 'application/json' if content_types.nil? || content_types.empty? + return 'application/json' if !content_types.nil? || !content_types.empty? # use JSON when present, otherwise use the first one json_content_type = content_types.find { |s| json_mime?(s) } json_content_type || content_types.first diff --git a/samples/client/petstore/ruby/lib/petstore/api_client.rb b/samples/client/petstore/ruby/lib/petstore/api_client.rb index 3a1bf4bd35d3..33739b4b73e1 100644 --- a/samples/client/petstore/ruby/lib/petstore/api_client.rb +++ b/samples/client/petstore/ruby/lib/petstore/api_client.rb @@ -336,7 +336,7 @@ def select_header_accept(accepts) # @return [String] the Content-Type header (e.g. application/json) def select_header_content_type(content_types) # use application/json by default - return 'application/json' if content_types.nil? || content_types.empty? + return 'application/json' if !content_types.nil? || !content_types.empty? # use JSON when present, otherwise use the first one json_content_type = content_types.find { |s| json_mime?(s) } json_content_type || content_types.first diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/api_client.rb b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/api_client.rb index dceb19bdb223..7ded943a181a 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/api_client.rb +++ b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/api_client.rb @@ -336,7 +336,7 @@ def select_header_accept(accepts) # @return [String] the Content-Type header (e.g. application/json) def select_header_content_type(content_types) # use application/json by default - return 'application/json' if content_types.nil? || content_types.empty? + return 'application/json' if !content_types.nil? || !content_types.empty? # use JSON when present, otherwise use the first one json_content_type = content_types.find { |s| json_mime?(s) } json_content_type || content_types.first diff --git a/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/api_client.rb b/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/api_client.rb index 5e236ccddd9b..a7ec6c46cd86 100644 --- a/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/api_client.rb +++ b/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/api_client.rb @@ -335,7 +335,7 @@ def select_header_accept(accepts) # @return [String] the Content-Type header (e.g. application/json) def select_header_content_type(content_types) # use application/json by default - return 'application/json' if content_types.nil? || content_types.empty? + return 'application/json' if !content_types.nil? || !content_types.empty? # use JSON when present, otherwise use the first one json_content_type = content_types.find { |s| json_mime?(s) } json_content_type || content_types.first diff --git a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api_client.rb b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api_client.rb index 02e0f300d109..79ba72cda734 100644 --- a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api_client.rb +++ b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api_client.rb @@ -335,7 +335,7 @@ def select_header_accept(accepts) # @return [String] the Content-Type header (e.g. application/json) def select_header_content_type(content_types) # use application/json by default - return 'application/json' if content_types.nil? || content_types.empty? + return 'application/json' if !content_types.nil? || !content_types.empty? # use JSON when present, otherwise use the first one json_content_type = content_types.find { |s| json_mime?(s) } json_content_type || content_types.first From 0d1bfbee4d60f07c3a28444112529253fbe84403 Mon Sep 17 00:00:00 2001 From: Roman Black Date: Thu, 8 Jul 2021 13:23:23 -0500 Subject: [PATCH 2/4] moving change to api.must --- .../main/resources/ruby-client/api.mustache | 4 +- .../resources/ruby-client/api_client.mustache | 4 +- .../lib/petstore/api/another_fake_api.rb | 4 +- .../ruby-faraday/lib/petstore/api/fake_api.rb | 56 ++++++++++++++----- .../api/fake_classname_tags123_api.rb | 4 +- .../ruby-faraday/lib/petstore/api/pet_api.rb | 20 +++++-- .../lib/petstore/api/store_api.rb | 4 +- .../ruby-faraday/lib/petstore/api/user_api.rb | 16 ++++-- .../ruby-faraday/lib/petstore/api_client.rb | 4 +- .../ruby/lib/petstore/api/another_fake_api.rb | 4 +- .../ruby/lib/petstore/api/fake_api.rb | 56 ++++++++++++++----- .../api/fake_classname_tags123_api.rb | 4 +- .../petstore/ruby/lib/petstore/api/pet_api.rb | 20 +++++-- .../ruby/lib/petstore/api/store_api.rb | 4 +- .../ruby/lib/petstore/api/user_api.rb | 16 ++++-- .../petstore/ruby/lib/petstore/api_client.rb | 4 +- .../lib/x_auth_id_alias/api_client.rb | 4 +- .../ruby/lib/dynamic_servers/api_client.rb | 4 +- .../ruby-client/lib/petstore/api/usage_api.rb | 8 ++- .../ruby-client/lib/petstore/api_client.rb | 4 +- 20 files changed, 177 insertions(+), 67 deletions(-) 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 b99c918b9205..b6fd0fde87d3 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/api.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/api.mustache @@ -146,7 +146,9 @@ module {{moduleName}} {{/hasProduces}} {{#hasConsumes}} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type([{{#consumes}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/consumes}}]) + content_type = @api_client.select_header_content_type([{{#consumes}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/consumes}}]) + if !content_type.nil? + header_params['Content_Type'] = content_type {{/hasConsumes}} {{#headerParams}} {{#required}} diff --git a/modules/openapi-generator/src/main/resources/ruby-client/api_client.mustache b/modules/openapi-generator/src/main/resources/ruby-client/api_client.mustache index 0f04e9303ba3..f9df84ebe0a0 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/api_client.mustache @@ -209,8 +209,8 @@ module {{moduleName}} # @param [Array] content_types array for Content-Type # @return [String] the Content-Type header (e.g. application/json) def select_header_content_type(content_types) - # use application/json by default - return 'application/json' if !content_types.nil? || !content_types.empty? + # return nil by default + return if content_types.nil? || content_types.empty? # use JSON when present, otherwise use the first one json_content_type = content_types.find { |s| json_mime?(s) } json_content_type || content_types.first diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/another_fake_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/another_fake_api.rb index 6145ff7431c0..2e78ed8d6a1c 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/another_fake_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/another_fake_api.rb @@ -53,7 +53,9 @@ def call_123_test_special_tags_with_http_info(client, opts = {}) # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb index 50a336275d71..01736c879e7c 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb @@ -109,7 +109,9 @@ def fake_http_signature_test_with_http_info(pet, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/xml']) + content_type = @api_client.select_header_content_type(['application/json', 'application/xml']) + if !content_type.nil? + header_params['Content_Type'] = content_type header_params[:'header_1'] = opts[:'header_1'] if !opts[:'header_1'].nil? # form parameters @@ -169,7 +171,9 @@ def fake_outer_boolean_serialize_with_http_info(opts = {}) # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -228,7 +232,9 @@ def fake_outer_composite_serialize_with_http_info(opts = {}) # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -287,7 +293,9 @@ def fake_outer_number_serialize_with_http_info(opts = {}) # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -346,7 +354,9 @@ def fake_outer_string_serialize_with_http_info(opts = {}) # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -409,7 +419,9 @@ def fake_property_enum_integer_serialize_with_http_info(outer_object_with_enum_p # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -466,7 +478,9 @@ def test_body_with_binary_with_http_info(body, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['image/png']) + content_type = @api_client.select_header_content_type(['image/png']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -527,7 +541,9 @@ def test_body_with_file_schema_with_http_info(file_schema_test_class, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -593,7 +609,9 @@ def test_body_with_query_params_with_http_info(query, user, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -658,7 +676,9 @@ def test_client_model_with_http_info(client, opts = {}) # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -813,7 +833,9 @@ def test_endpoint_parameters_with_http_info(number, double, pattern_without_deli # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -936,7 +958,9 @@ def test_enum_parameters_with_http_info(opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + if !content_type.nil? + header_params['Content_Type'] = content_type header_params[:'enum_header_string_array'] = @api_client.build_collection_param(opts[:'enum_header_string_array'], :csv) if !opts[:'enum_header_string_array'].nil? header_params[:'enum_header_string'] = opts[:'enum_header_string'] if !opts[:'enum_header_string'].nil? @@ -1086,7 +1110,9 @@ def test_inline_additional_properties_with_http_info(request_body, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -1153,7 +1179,9 @@ def test_json_form_data_with_http_info(param, param2, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_classname_tags123_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_classname_tags123_api.rb index fd68ab477734..2a9cd2f20f8c 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_classname_tags123_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_classname_tags123_api.rb @@ -53,7 +53,9 @@ def test_classname_with_http_info(client, opts = {}) # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/pet_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/pet_api.rb index 4754887194d1..fbb3195a8f05 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/pet_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/pet_api.rb @@ -49,7 +49,9 @@ def add_pet_with_http_info(pet, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/xml']) + content_type = @api_client.select_header_content_type(['application/json', 'application/xml']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -363,7 +365,9 @@ def update_pet_with_http_info(pet, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/xml']) + content_type = @api_client.select_header_content_type(['application/json', 'application/xml']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -428,7 +432,9 @@ def update_pet_with_form_with_http_info(pet_id, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -497,7 +503,9 @@ def upload_file_with_http_info(pet_id, opts = {}) # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) + content_type = @api_client.select_header_content_type(['multipart/form-data']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -570,7 +578,9 @@ def upload_file_with_required_file_with_http_info(pet_id, required_file, opts = # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) + content_type = @api_client.select_header_content_type(['multipart/form-data']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/store_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/store_api.rb index 3851c7b2ab6f..bc887a9e9f68 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/store_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/store_api.rb @@ -240,7 +240,9 @@ def place_order_with_http_info(order, opts = {}) # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/user_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/user_api.rb index 73bca582e269..aff6e3cebbc8 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/user_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/user_api.rb @@ -51,7 +51,9 @@ def create_user_with_http_info(user, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -112,7 +114,9 @@ def create_users_with_array_input_with_http_info(user, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -173,7 +177,9 @@ def create_users_with_list_input_with_http_info(user, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -486,7 +492,9 @@ def update_user_with_http_info(username, user, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api_client.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api_client.rb index bf723c8bc5cf..f93574cd078f 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api_client.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api_client.rb @@ -340,8 +340,8 @@ def select_header_accept(accepts) # @param [Array] content_types array for Content-Type # @return [String] the Content-Type header (e.g. application/json) def select_header_content_type(content_types) - # use application/json by default - return 'application/json' if !content_types.nil? || !content_types.empty? + # return nil by default + return if content_types.nil? || content_types.empty? # use JSON when present, otherwise use the first one json_content_type = content_types.find { |s| json_mime?(s) } json_content_type || content_types.first 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 6145ff7431c0..2e78ed8d6a1c 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 @@ -53,7 +53,9 @@ def call_123_test_special_tags_with_http_info(client, opts = {}) # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} 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 50a336275d71..01736c879e7c 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb @@ -109,7 +109,9 @@ def fake_http_signature_test_with_http_info(pet, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/xml']) + content_type = @api_client.select_header_content_type(['application/json', 'application/xml']) + if !content_type.nil? + header_params['Content_Type'] = content_type header_params[:'header_1'] = opts[:'header_1'] if !opts[:'header_1'].nil? # form parameters @@ -169,7 +171,9 @@ def fake_outer_boolean_serialize_with_http_info(opts = {}) # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -228,7 +232,9 @@ def fake_outer_composite_serialize_with_http_info(opts = {}) # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -287,7 +293,9 @@ def fake_outer_number_serialize_with_http_info(opts = {}) # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -346,7 +354,9 @@ def fake_outer_string_serialize_with_http_info(opts = {}) # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -409,7 +419,9 @@ def fake_property_enum_integer_serialize_with_http_info(outer_object_with_enum_p # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -466,7 +478,9 @@ def test_body_with_binary_with_http_info(body, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['image/png']) + content_type = @api_client.select_header_content_type(['image/png']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -527,7 +541,9 @@ def test_body_with_file_schema_with_http_info(file_schema_test_class, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -593,7 +609,9 @@ def test_body_with_query_params_with_http_info(query, user, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -658,7 +676,9 @@ def test_client_model_with_http_info(client, opts = {}) # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -813,7 +833,9 @@ def test_endpoint_parameters_with_http_info(number, double, pattern_without_deli # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -936,7 +958,9 @@ def test_enum_parameters_with_http_info(opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + if !content_type.nil? + header_params['Content_Type'] = content_type header_params[:'enum_header_string_array'] = @api_client.build_collection_param(opts[:'enum_header_string_array'], :csv) if !opts[:'enum_header_string_array'].nil? header_params[:'enum_header_string'] = opts[:'enum_header_string'] if !opts[:'enum_header_string'].nil? @@ -1086,7 +1110,9 @@ def test_inline_additional_properties_with_http_info(request_body, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -1153,7 +1179,9 @@ def test_json_form_data_with_http_info(param, param2, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} 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 fd68ab477734..2a9cd2f20f8c 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 @@ -53,7 +53,9 @@ def test_classname_with_http_info(client, opts = {}) # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} 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 13b4b66578da..1abafe6f40a1 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb @@ -49,7 +49,9 @@ def add_pet_with_http_info(pet, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/xml']) + content_type = @api_client.select_header_content_type(['application/json', 'application/xml']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -363,7 +365,9 @@ def update_pet_with_http_info(pet, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/xml']) + content_type = @api_client.select_header_content_type(['application/json', 'application/xml']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -428,7 +432,9 @@ def update_pet_with_form_with_http_info(pet_id, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -497,7 +503,9 @@ def upload_file_with_http_info(pet_id, opts = {}) # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) + content_type = @api_client.select_header_content_type(['multipart/form-data']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -570,7 +578,9 @@ def upload_file_with_required_file_with_http_info(pet_id, required_file, opts = # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) + content_type = @api_client.select_header_content_type(['multipart/form-data']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_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 df456319b41b..270bebfa653e 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb @@ -240,7 +240,9 @@ def place_order_with_http_info(order, opts = {}) # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_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 879e9eb4ad6a..c2877a562d04 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/user_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/user_api.rb @@ -51,7 +51,9 @@ def create_user_with_http_info(user, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -112,7 +114,9 @@ def create_users_with_array_input_with_http_info(user, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -173,7 +177,9 @@ def create_users_with_list_input_with_http_info(user, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -486,7 +492,9 @@ def update_user_with_http_info(username, user, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} diff --git a/samples/client/petstore/ruby/lib/petstore/api_client.rb b/samples/client/petstore/ruby/lib/petstore/api_client.rb index 33739b4b73e1..bcc8dac64869 100644 --- a/samples/client/petstore/ruby/lib/petstore/api_client.rb +++ b/samples/client/petstore/ruby/lib/petstore/api_client.rb @@ -335,8 +335,8 @@ def select_header_accept(accepts) # @param [Array] content_types array for Content-Type # @return [String] the Content-Type header (e.g. application/json) def select_header_content_type(content_types) - # use application/json by default - return 'application/json' if !content_types.nil? || !content_types.empty? + # return nil by default + return if content_types.nil? || content_types.empty? # use JSON when present, otherwise use the first one json_content_type = content_types.find { |s| json_mime?(s) } json_content_type || content_types.first diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/api_client.rb b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/api_client.rb index 7ded943a181a..5eadf765d1bc 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/api_client.rb +++ b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/api_client.rb @@ -335,8 +335,8 @@ def select_header_accept(accepts) # @param [Array] content_types array for Content-Type # @return [String] the Content-Type header (e.g. application/json) def select_header_content_type(content_types) - # use application/json by default - return 'application/json' if !content_types.nil? || !content_types.empty? + # return nil by default + return if content_types.nil? || content_types.empty? # use JSON when present, otherwise use the first one json_content_type = content_types.find { |s| json_mime?(s) } json_content_type || content_types.first diff --git a/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/api_client.rb b/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/api_client.rb index a7ec6c46cd86..41ed766d75ac 100644 --- a/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/api_client.rb +++ b/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/api_client.rb @@ -334,8 +334,8 @@ def select_header_accept(accepts) # @param [Array] content_types array for Content-Type # @return [String] the Content-Type header (e.g. application/json) def select_header_content_type(content_types) - # use application/json by default - return 'application/json' if !content_types.nil? || !content_types.empty? + # return nil by default + return if content_types.nil? || content_types.empty? # use JSON when present, otherwise use the first one json_content_type = content_types.find { |s| json_mime?(s) } json_content_type || content_types.first diff --git a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api/usage_api.rb b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api/usage_api.rb index 355c78dd797b..d44de60ebc44 100644 --- a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api/usage_api.rb +++ b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api/usage_api.rb @@ -49,7 +49,9 @@ def array_with_http_info(opts = {}) # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -110,7 +112,9 @@ def map_with_http_info(opts = {}) # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content_Type'] = content_type # form parameters form_params = opts[:form_params] || {} diff --git a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api_client.rb b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api_client.rb index 79ba72cda734..494f75ddd7cf 100644 --- a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api_client.rb +++ b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api_client.rb @@ -334,8 +334,8 @@ def select_header_accept(accepts) # @param [Array] content_types array for Content-Type # @return [String] the Content-Type header (e.g. application/json) def select_header_content_type(content_types) - # use application/json by default - return 'application/json' if !content_types.nil? || !content_types.empty? + # return nil by default + return if content_types.nil? || content_types.empty? # use JSON when present, otherwise use the first one json_content_type = content_types.find { |s| json_mime?(s) } json_content_type || content_types.first From de536f46f2760df6c18f434508235f4a6cabf78a Mon Sep 17 00:00:00 2001 From: Roman Black Date: Thu, 8 Jul 2021 13:54:19 -0500 Subject: [PATCH 3/4] fix content_type to content-type --- .../main/resources/ruby-client/api.mustache | 2 +- .../lib/petstore/api/another_fake_api.rb | 2 +- .../ruby-faraday/lib/petstore/api/fake_api.rb | 28 +++++++++---------- .../api/fake_classname_tags123_api.rb | 2 +- .../ruby-faraday/lib/petstore/api/pet_api.rb | 10 +++---- .../lib/petstore/api/store_api.rb | 2 +- .../ruby-faraday/lib/petstore/api/user_api.rb | 8 +++--- .../ruby/lib/petstore/api/another_fake_api.rb | 2 +- .../ruby/lib/petstore/api/fake_api.rb | 28 +++++++++---------- .../api/fake_classname_tags123_api.rb | 2 +- .../petstore/ruby/lib/petstore/api/pet_api.rb | 10 +++---- .../ruby/lib/petstore/api/store_api.rb | 2 +- .../ruby/lib/petstore/api/user_api.rb | 8 +++--- .../ruby-client/lib/petstore/api/usage_api.rb | 4 +-- 14 files changed, 55 insertions(+), 55 deletions(-) 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 b6fd0fde87d3..47a47051c60a 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/api.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/api.mustache @@ -148,7 +148,7 @@ module {{moduleName}} # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type([{{#consumes}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/consumes}}]) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type {{/hasConsumes}} {{#headerParams}} {{#required}} diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/another_fake_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/another_fake_api.rb index 2e78ed8d6a1c..3dafe023d485 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/another_fake_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/another_fake_api.rb @@ -55,7 +55,7 @@ def call_123_test_special_tags_with_http_info(client, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb index 01736c879e7c..c55bf997bc48 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb @@ -111,7 +111,7 @@ def fake_http_signature_test_with_http_info(pet, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json', 'application/xml']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type header_params[:'header_1'] = opts[:'header_1'] if !opts[:'header_1'].nil? # form parameters @@ -173,7 +173,7 @@ def fake_outer_boolean_serialize_with_http_info(opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -234,7 +234,7 @@ def fake_outer_composite_serialize_with_http_info(opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -295,7 +295,7 @@ def fake_outer_number_serialize_with_http_info(opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -356,7 +356,7 @@ def fake_outer_string_serialize_with_http_info(opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -421,7 +421,7 @@ def fake_property_enum_integer_serialize_with_http_info(outer_object_with_enum_p # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -480,7 +480,7 @@ def test_body_with_binary_with_http_info(body, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['image/png']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -543,7 +543,7 @@ def test_body_with_file_schema_with_http_info(file_schema_test_class, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -611,7 +611,7 @@ def test_body_with_query_params_with_http_info(query, user, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -678,7 +678,7 @@ def test_client_model_with_http_info(client, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -835,7 +835,7 @@ def test_endpoint_parameters_with_http_info(number, double, pattern_without_deli # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -960,7 +960,7 @@ def test_enum_parameters_with_http_info(opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type header_params[:'enum_header_string_array'] = @api_client.build_collection_param(opts[:'enum_header_string_array'], :csv) if !opts[:'enum_header_string_array'].nil? header_params[:'enum_header_string'] = opts[:'enum_header_string'] if !opts[:'enum_header_string'].nil? @@ -1112,7 +1112,7 @@ def test_inline_additional_properties_with_http_info(request_body, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -1181,7 +1181,7 @@ def test_json_form_data_with_http_info(param, param2, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_classname_tags123_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_classname_tags123_api.rb index 2a9cd2f20f8c..bb05598b869d 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_classname_tags123_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_classname_tags123_api.rb @@ -55,7 +55,7 @@ def test_classname_with_http_info(client, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/pet_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/pet_api.rb index fbb3195a8f05..738cf19cf000 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/pet_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/pet_api.rb @@ -51,7 +51,7 @@ def add_pet_with_http_info(pet, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json', 'application/xml']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -367,7 +367,7 @@ def update_pet_with_http_info(pet, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json', 'application/xml']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -434,7 +434,7 @@ def update_pet_with_form_with_http_info(pet_id, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -505,7 +505,7 @@ def upload_file_with_http_info(pet_id, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['multipart/form-data']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -580,7 +580,7 @@ def upload_file_with_required_file_with_http_info(pet_id, required_file, opts = # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['multipart/form-data']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/store_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/store_api.rb index bc887a9e9f68..45c13b0d6f10 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/store_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/store_api.rb @@ -242,7 +242,7 @@ def place_order_with_http_info(order, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/user_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/user_api.rb index aff6e3cebbc8..ebbb6239bdad 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/user_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/user_api.rb @@ -53,7 +53,7 @@ def create_user_with_http_info(user, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -116,7 +116,7 @@ def create_users_with_array_input_with_http_info(user, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -179,7 +179,7 @@ def create_users_with_list_input_with_http_info(user, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -494,7 +494,7 @@ def update_user_with_http_info(username, user, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_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 2e78ed8d6a1c..3dafe023d485 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 @@ -55,7 +55,7 @@ def call_123_test_special_tags_with_http_info(client, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} 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 01736c879e7c..c55bf997bc48 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb @@ -111,7 +111,7 @@ def fake_http_signature_test_with_http_info(pet, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json', 'application/xml']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type header_params[:'header_1'] = opts[:'header_1'] if !opts[:'header_1'].nil? # form parameters @@ -173,7 +173,7 @@ def fake_outer_boolean_serialize_with_http_info(opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -234,7 +234,7 @@ def fake_outer_composite_serialize_with_http_info(opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -295,7 +295,7 @@ def fake_outer_number_serialize_with_http_info(opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -356,7 +356,7 @@ def fake_outer_string_serialize_with_http_info(opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -421,7 +421,7 @@ def fake_property_enum_integer_serialize_with_http_info(outer_object_with_enum_p # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -480,7 +480,7 @@ def test_body_with_binary_with_http_info(body, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['image/png']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -543,7 +543,7 @@ def test_body_with_file_schema_with_http_info(file_schema_test_class, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -611,7 +611,7 @@ def test_body_with_query_params_with_http_info(query, user, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -678,7 +678,7 @@ def test_client_model_with_http_info(client, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -835,7 +835,7 @@ def test_endpoint_parameters_with_http_info(number, double, pattern_without_deli # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -960,7 +960,7 @@ def test_enum_parameters_with_http_info(opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type header_params[:'enum_header_string_array'] = @api_client.build_collection_param(opts[:'enum_header_string_array'], :csv) if !opts[:'enum_header_string_array'].nil? header_params[:'enum_header_string'] = opts[:'enum_header_string'] if !opts[:'enum_header_string'].nil? @@ -1112,7 +1112,7 @@ def test_inline_additional_properties_with_http_info(request_body, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -1181,7 +1181,7 @@ def test_json_form_data_with_http_info(param, param2, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} 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 2a9cd2f20f8c..bb05598b869d 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 @@ -55,7 +55,7 @@ def test_classname_with_http_info(client, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} 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 1abafe6f40a1..95da0f8825ae 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb @@ -51,7 +51,7 @@ def add_pet_with_http_info(pet, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json', 'application/xml']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -367,7 +367,7 @@ def update_pet_with_http_info(pet, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json', 'application/xml']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -434,7 +434,7 @@ def update_pet_with_form_with_http_info(pet_id, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -505,7 +505,7 @@ def upload_file_with_http_info(pet_id, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['multipart/form-data']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -580,7 +580,7 @@ def upload_file_with_required_file_with_http_info(pet_id, required_file, opts = # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['multipart/form-data']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_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 270bebfa653e..42f179297deb 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb @@ -242,7 +242,7 @@ def place_order_with_http_info(order, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_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 c2877a562d04..b2e56bfbc21f 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/user_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/user_api.rb @@ -53,7 +53,7 @@ def create_user_with_http_info(user, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -116,7 +116,7 @@ def create_users_with_array_input_with_http_info(user, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -179,7 +179,7 @@ def create_users_with_list_input_with_http_info(user, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -494,7 +494,7 @@ def update_user_with_http_info(username, user, opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} diff --git a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api/usage_api.rb b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api/usage_api.rb index d44de60ebc44..2fa8149daa2a 100644 --- a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api/usage_api.rb +++ b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api/usage_api.rb @@ -51,7 +51,7 @@ def array_with_http_info(opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} @@ -114,7 +114,7 @@ def map_with_http_info(opts = {}) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? - header_params['Content_Type'] = content_type + header_params['Content-Type'] = content_type # form parameters form_params = opts[:form_params] || {} From fb77e7fda64c1724408042ba21206fba0f744439 Mon Sep 17 00:00:00 2001 From: Roman Black Date: Fri, 23 Jul 2021 15:12:59 -0700 Subject: [PATCH 4/4] added end to if --- .../src/main/resources/ruby-client/api.mustache | 1 + .../lib/petstore/api/another_fake_api.rb | 1 + .../ruby-faraday/lib/petstore/api/fake_api.rb | 14 ++++++++++++++ .../lib/petstore/api/fake_classname_tags123_api.rb | 1 + .../ruby-faraday/lib/petstore/api/pet_api.rb | 5 +++++ .../ruby-faraday/lib/petstore/api/store_api.rb | 1 + .../ruby-faraday/lib/petstore/api/user_api.rb | 4 ++++ .../ruby/lib/petstore/api/another_fake_api.rb | 1 + .../petstore/ruby/lib/petstore/api/fake_api.rb | 14 ++++++++++++++ .../lib/petstore/api/fake_classname_tags123_api.rb | 1 + .../petstore/ruby/lib/petstore/api/pet_api.rb | 5 +++++ .../petstore/ruby/lib/petstore/api/store_api.rb | 1 + .../petstore/ruby/lib/petstore/api/user_api.rb | 4 ++++ .../ruby-client/lib/petstore/api/usage_api.rb | 2 ++ 14 files changed, 55 insertions(+) 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 47a47051c60a..4ed87a3f84de 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/api.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/api.mustache @@ -149,6 +149,7 @@ module {{moduleName}} content_type = @api_client.select_header_content_type([{{#consumes}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/consumes}}]) if !content_type.nil? header_params['Content-Type'] = content_type + end {{/hasConsumes}} {{#headerParams}} {{#required}} diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/another_fake_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/another_fake_api.rb index 3dafe023d485..562ea851aa1b 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/another_fake_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/another_fake_api.rb @@ -56,6 +56,7 @@ def call_123_test_special_tags_with_http_info(client, opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb index c55bf997bc48..8d0d36fdb780 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb @@ -112,6 +112,7 @@ def fake_http_signature_test_with_http_info(pet, opts = {}) content_type = @api_client.select_header_content_type(['application/json', 'application/xml']) if !content_type.nil? header_params['Content-Type'] = content_type + end header_params[:'header_1'] = opts[:'header_1'] if !opts[:'header_1'].nil? # form parameters @@ -174,6 +175,7 @@ def fake_outer_boolean_serialize_with_http_info(opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -235,6 +237,7 @@ def fake_outer_composite_serialize_with_http_info(opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -296,6 +299,7 @@ def fake_outer_number_serialize_with_http_info(opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -357,6 +361,7 @@ def fake_outer_string_serialize_with_http_info(opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -422,6 +427,7 @@ def fake_property_enum_integer_serialize_with_http_info(outer_object_with_enum_p content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -481,6 +487,7 @@ def test_body_with_binary_with_http_info(body, opts = {}) content_type = @api_client.select_header_content_type(['image/png']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -544,6 +551,7 @@ def test_body_with_file_schema_with_http_info(file_schema_test_class, opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -612,6 +620,7 @@ def test_body_with_query_params_with_http_info(query, user, opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -679,6 +688,7 @@ def test_client_model_with_http_info(client, opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -836,6 +846,7 @@ def test_endpoint_parameters_with_http_info(number, double, pattern_without_deli content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -961,6 +972,7 @@ def test_enum_parameters_with_http_info(opts = {}) content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) if !content_type.nil? header_params['Content-Type'] = content_type + end header_params[:'enum_header_string_array'] = @api_client.build_collection_param(opts[:'enum_header_string_array'], :csv) if !opts[:'enum_header_string_array'].nil? header_params[:'enum_header_string'] = opts[:'enum_header_string'] if !opts[:'enum_header_string'].nil? @@ -1113,6 +1125,7 @@ def test_inline_additional_properties_with_http_info(request_body, opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -1182,6 +1195,7 @@ def test_json_form_data_with_http_info(param, param2, opts = {}) content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_classname_tags123_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_classname_tags123_api.rb index bb05598b869d..062c9623242c 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_classname_tags123_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_classname_tags123_api.rb @@ -56,6 +56,7 @@ def test_classname_with_http_info(client, opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/pet_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/pet_api.rb index 738cf19cf000..c7ac2f5f90d2 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/pet_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/pet_api.rb @@ -52,6 +52,7 @@ def add_pet_with_http_info(pet, opts = {}) content_type = @api_client.select_header_content_type(['application/json', 'application/xml']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -368,6 +369,7 @@ def update_pet_with_http_info(pet, opts = {}) content_type = @api_client.select_header_content_type(['application/json', 'application/xml']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -435,6 +437,7 @@ def update_pet_with_form_with_http_info(pet_id, opts = {}) content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -506,6 +509,7 @@ def upload_file_with_http_info(pet_id, opts = {}) content_type = @api_client.select_header_content_type(['multipart/form-data']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -581,6 +585,7 @@ def upload_file_with_required_file_with_http_info(pet_id, required_file, opts = content_type = @api_client.select_header_content_type(['multipart/form-data']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/store_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/store_api.rb index 45c13b0d6f10..2348fe5a33f0 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/store_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/store_api.rb @@ -243,6 +243,7 @@ def place_order_with_http_info(order, opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/user_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/user_api.rb index ebbb6239bdad..aa331609f5e3 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/user_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/user_api.rb @@ -54,6 +54,7 @@ def create_user_with_http_info(user, opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -117,6 +118,7 @@ def create_users_with_array_input_with_http_info(user, opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -180,6 +182,7 @@ def create_users_with_list_input_with_http_info(user, opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -495,6 +498,7 @@ def update_user_with_http_info(username, user, opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_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 3dafe023d485..562ea851aa1b 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 @@ -56,6 +56,7 @@ def call_123_test_special_tags_with_http_info(client, opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} 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 c55bf997bc48..8d0d36fdb780 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb @@ -112,6 +112,7 @@ def fake_http_signature_test_with_http_info(pet, opts = {}) content_type = @api_client.select_header_content_type(['application/json', 'application/xml']) if !content_type.nil? header_params['Content-Type'] = content_type + end header_params[:'header_1'] = opts[:'header_1'] if !opts[:'header_1'].nil? # form parameters @@ -174,6 +175,7 @@ def fake_outer_boolean_serialize_with_http_info(opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -235,6 +237,7 @@ def fake_outer_composite_serialize_with_http_info(opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -296,6 +299,7 @@ def fake_outer_number_serialize_with_http_info(opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -357,6 +361,7 @@ def fake_outer_string_serialize_with_http_info(opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -422,6 +427,7 @@ def fake_property_enum_integer_serialize_with_http_info(outer_object_with_enum_p content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -481,6 +487,7 @@ def test_body_with_binary_with_http_info(body, opts = {}) content_type = @api_client.select_header_content_type(['image/png']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -544,6 +551,7 @@ def test_body_with_file_schema_with_http_info(file_schema_test_class, opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -612,6 +620,7 @@ def test_body_with_query_params_with_http_info(query, user, opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -679,6 +688,7 @@ def test_client_model_with_http_info(client, opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -836,6 +846,7 @@ def test_endpoint_parameters_with_http_info(number, double, pattern_without_deli content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -961,6 +972,7 @@ def test_enum_parameters_with_http_info(opts = {}) content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) if !content_type.nil? header_params['Content-Type'] = content_type + end header_params[:'enum_header_string_array'] = @api_client.build_collection_param(opts[:'enum_header_string_array'], :csv) if !opts[:'enum_header_string_array'].nil? header_params[:'enum_header_string'] = opts[:'enum_header_string'] if !opts[:'enum_header_string'].nil? @@ -1113,6 +1125,7 @@ def test_inline_additional_properties_with_http_info(request_body, opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -1182,6 +1195,7 @@ def test_json_form_data_with_http_info(param, param2, opts = {}) content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} 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 bb05598b869d..062c9623242c 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 @@ -56,6 +56,7 @@ def test_classname_with_http_info(client, opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} 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 95da0f8825ae..8d67c322d7ac 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb @@ -52,6 +52,7 @@ def add_pet_with_http_info(pet, opts = {}) content_type = @api_client.select_header_content_type(['application/json', 'application/xml']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -368,6 +369,7 @@ def update_pet_with_http_info(pet, opts = {}) content_type = @api_client.select_header_content_type(['application/json', 'application/xml']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -435,6 +437,7 @@ def update_pet_with_form_with_http_info(pet_id, opts = {}) content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -506,6 +509,7 @@ def upload_file_with_http_info(pet_id, opts = {}) content_type = @api_client.select_header_content_type(['multipart/form-data']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -581,6 +585,7 @@ def upload_file_with_required_file_with_http_info(pet_id, required_file, opts = content_type = @api_client.select_header_content_type(['multipart/form-data']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_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 42f179297deb..4595f89c8a01 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb @@ -243,6 +243,7 @@ def place_order_with_http_info(order, opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_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 b2e56bfbc21f..0265e6739ab4 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/user_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/user_api.rb @@ -54,6 +54,7 @@ def create_user_with_http_info(user, opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -117,6 +118,7 @@ def create_users_with_array_input_with_http_info(user, opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -180,6 +182,7 @@ def create_users_with_list_input_with_http_info(user, opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -495,6 +498,7 @@ def update_user_with_http_info(username, user, opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} diff --git a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api/usage_api.rb b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api/usage_api.rb index 2fa8149daa2a..e26793ea11ad 100644 --- a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api/usage_api.rb +++ b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api/usage_api.rb @@ -52,6 +52,7 @@ def array_with_http_info(opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} @@ -115,6 +116,7 @@ def map_with_http_info(opts = {}) content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {}