From aba2d35a18784c8cc52912e68a6f38505ac92042 Mon Sep 17 00:00:00 2001 From: Cliffano Subagio Date: Tue, 9 Aug 2016 19:11:26 +1000 Subject: [PATCH] Fix unknown parameter on api_client's update_params_for_auth method. --- .../main/resources/ruby/api_client.mustache | 2 +- samples/client/petstore/ruby/README.md | 14 ++++----- .../client/petstore/ruby/docs/EnumArrays.md | 2 +- .../petstore/ruby/lib/petstore/api_client.rb | 2 +- .../ruby/lib/petstore/configuration.rb | 14 ++++----- .../ruby/lib/petstore/models/enum_arrays.rb | 30 +++++++++---------- 6 files changed, 32 insertions(+), 32 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/ruby/api_client.mustache b/modules/swagger-codegen/src/main/resources/ruby/api_client.mustache index 566d097449f5..3e65c72e9329 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/api_client.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/api_client.mustache @@ -271,7 +271,7 @@ module {{moduleName}} # Update hearder and query params based on authentication settings. # # @param [Hash] header_params Header parameters - # @param [Hash] form_params Query parameters + # @param [Hash] query_params Query parameters # @param [String] auth_names Authentication scheme name def update_params_for_auth!(header_params, query_params, auth_names) Array(auth_names).each do |auth_name| diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index 81ab585ab5fe..f1f63920b6ca 100644 --- a/samples/client/petstore/ruby/README.md +++ b/samples/client/petstore/ruby/README.md @@ -8,7 +8,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/ - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-08-03T00:39:31.384+08:00 +- Build date: 2016-08-09T19:11:03.532+10:00 - Build package: class io.swagger.codegen.languages.RubyClientCodegen ## Installation @@ -137,12 +137,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth - **Type**: OAuth @@ -152,3 +146,9 @@ Class | Method | HTTP request | Description - write:pets: modify pets in your account - read:pets: read your pets +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + diff --git a/samples/client/petstore/ruby/docs/EnumArrays.md b/samples/client/petstore/ruby/docs/EnumArrays.md index 70302d71ef83..ef6a935fbd79 100644 --- a/samples/client/petstore/ruby/docs/EnumArrays.md +++ b/samples/client/petstore/ruby/docs/EnumArrays.md @@ -3,7 +3,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**just_enum** | **String** | | [optional] +**just_symbol** | **String** | | [optional] **array_enum** | **Array<String>** | | [optional] diff --git a/samples/client/petstore/ruby/lib/petstore/api_client.rb b/samples/client/petstore/ruby/lib/petstore/api_client.rb index b6de12280b65..52ba90b20829 100644 --- a/samples/client/petstore/ruby/lib/petstore/api_client.rb +++ b/samples/client/petstore/ruby/lib/petstore/api_client.rb @@ -288,7 +288,7 @@ module Petstore # Update hearder and query params based on authentication settings. # # @param [Hash] header_params Header parameters - # @param [Hash] form_params Query parameters + # @param [Hash] query_params Query parameters # @param [String] auth_names Authentication scheme name def update_params_for_auth!(header_params, query_params, auth_names) Array(auth_names).each do |auth_name| diff --git a/samples/client/petstore/ruby/lib/petstore/configuration.rb b/samples/client/petstore/ruby/lib/petstore/configuration.rb index 1cff3c3ba271..4020a8cf1180 100644 --- a/samples/client/petstore/ruby/lib/petstore/configuration.rb +++ b/samples/client/petstore/ruby/lib/petstore/configuration.rb @@ -201,13 +201,6 @@ module Petstore # Returns Auth Settings hash for api client. def auth_settings { - 'api_key' => - { - type: 'api_key', - in: 'header', - key: 'api_key', - value: api_key_with_prefix('api_key') - }, 'petstore_auth' => { type: 'oauth2', @@ -215,6 +208,13 @@ module Petstore key: 'Authorization', value: "Bearer #{access_token}" }, + 'api_key' => + { + type: 'api_key', + in: 'header', + key: 'api_key', + value: api_key_with_prefix('api_key') + }, } end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/enum_arrays.rb b/samples/client/petstore/ruby/lib/petstore/models/enum_arrays.rb index d0c35ddd576f..1c56f3a2db2e 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/enum_arrays.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/enum_arrays.rb @@ -26,7 +26,7 @@ require 'date' module Petstore class EnumArrays - attr_accessor :just_enum + attr_accessor :just_symbol attr_accessor :array_enum @@ -55,7 +55,7 @@ module Petstore # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'just_enum' => :'just_enum', + :'just_symbol' => :'just_symbol', :'array_enum' => :'array_enum' } end @@ -63,7 +63,7 @@ module Petstore # Attribute type mapping. def self.swagger_types { - :'just_enum' => :'String', + :'just_symbol' => :'String', :'array_enum' => :'Array' } end @@ -76,8 +76,8 @@ module Petstore # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} - if attributes.has_key?(:'just_enum') - self.just_enum = attributes[:'just_enum'] + if attributes.has_key?(:'just_symbol') + self.just_symbol = attributes[:'just_symbol'] end if attributes.has_key?(:'array_enum') @@ -98,19 +98,19 @@ module Petstore # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? - just_enum_validator = EnumAttributeValidator.new('String', ["bird", "eagle"]) - return false unless just_enum_validator.valid?(@just_enum) + just_symbol_validator = EnumAttributeValidator.new('String', [">=", "$"]) + return false unless just_symbol_validator.valid?(@just_symbol) return true end # Custom attribute writer method checking allowed values (enum). - # @param [Object] just_enum Object to be assigned - def just_enum=(just_enum) - validator = EnumAttributeValidator.new('String', ["bird", "eagle"]) - unless validator.valid?(just_enum) - fail ArgumentError, "invalid value for 'just_enum', must be one of #{validator.allowable_values}." + # @param [Object] just_symbol Object to be assigned + def just_symbol=(just_symbol) + validator = EnumAttributeValidator.new('String', [">=", "$"]) + unless validator.valid?(just_symbol) + fail ArgumentError, "invalid value for 'just_symbol', must be one of #{validator.allowable_values}." end - @just_enum = just_enum + @just_symbol = just_symbol end # Checks equality by comparing each attribute. @@ -118,7 +118,7 @@ module Petstore def ==(o) return true if self.equal?(o) self.class == o.class && - just_enum == o.just_enum && + just_symbol == o.just_symbol && array_enum == o.array_enum end @@ -131,7 +131,7 @@ module Petstore # Calculates hash code according to all attributes. # @return [Fixnum] Hash code def hash - [just_enum, array_enum].hash + [just_symbol, array_enum].hash end # Builds the object from hash