diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java index 23004861fe..e7d3d648d5 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java @@ -1,5 +1,6 @@ package org.openapitools.codegen.languages; +import io.swagger.v3.oas.models.media.*; import org.openapitools.codegen.CliOption; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.CodegenConstants; @@ -17,12 +18,6 @@ import java.util.Map; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; -import io.swagger.v3.oas.models.media.ArraySchema; -import io.swagger.v3.oas.models.media.DateSchema; -import io.swagger.v3.oas.models.media.DateTimeSchema; -import io.swagger.v3.oas.models.media.MapSchema; -import io.swagger.v3.oas.models.media.Schema; -import io.swagger.v3.oas.models.media.StringSchema; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -78,15 +73,15 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig { setReservedWordsLowerCase( Arrays.asList( - // local variable names used in API methods (endpoints) - "local_var_path", "query_params", "header_params", "_header_accept", "_header_accept_result", - "_header_content_type", "form_params", "post_body", "auth_names", - // ruby reserved keywords - "__FILE__", "and", "def", "end", "in", "or", "self", "unless", "__LINE__", - "begin", "defined?", "ensure", "module", "redo", "super", "until", "BEGIN", - "break", "do", "false", "next", "rescue", "then", "when", "END", "case", - "else", "for", "nil", "retry", "true", "while", "alias", "class", "elsif", - "if", "not", "return", "undef", "yield") + // local variable names used in API methods (endpoints) + "local_var_path", "query_params", "header_params", "_header_accept", "_header_accept_result", + "_header_content_type", "form_params", "post_body", "auth_names", + // ruby reserved keywords + "__FILE__", "and", "def", "end", "in", "or", "self", "unless", "__LINE__", + "begin", "defined?", "ensure", "module", "redo", "super", "until", "BEGIN", + "break", "do", "false", "next", "rescue", "then", "when", "END", "case", + "else", "for", "nil", "retry", "true", "while", "alias", "class", "elsif", + "if", "not", "return", "undef", "yield") ); typeMapping.clear(); @@ -202,7 +197,7 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig { if (additionalProperties.containsKey(GEM_VERSION)) { setGemVersion((String) additionalProperties.get(GEM_VERSION)); - }else { + } else { // not set, pass the default value to template additionalProperties.put(GEM_VERSION, gemVersion); } @@ -325,7 +320,7 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig { /** * Generate Ruby gem name from the module name, e.g. use "swagger_client" for "SwaggerClient". * - * @param moduleName Ruby module naame + * @param moduleName Ruby module naame * @return Ruby gem name */ @SuppressWarnings("static-method") @@ -334,8 +329,8 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig { } @Override - public String escapeReservedWord(String name) { - if(this.reservedWordsMappings().containsKey(name)) { + public String escapeReservedWord(String name) { + if (this.reservedWordsMappings().containsKey(name)) { return this.reservedWordsMappings().get(name); } return "_" + name; @@ -375,25 +370,26 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig { public String getTypeDeclaration(Schema schema) { if (schema instanceof ArraySchema) { Schema inner = ((ArraySchema) schema).getItems(); - return String.format("%s[%s]", getSchemaType(schema), getTypeDeclaration(inner)); + return getSchemaType(schema) + "<" + getTypeDeclaration(inner) + ">"; } else if (isMapSchema(schema)) { Schema inner = (Schema) schema.getAdditionalProperties(); - return String.format("%s[String, %s]", getSchemaType(schema), getTypeDeclaration(inner)); + return getSchemaType(schema) + ""; } return super.getTypeDeclaration(schema); } @Override - public String toDefaultValue(Schema schema) { - if(schema instanceof StringSchema) { - if (schema.getDefault() != null) { - return String.format("\"%s\"", schema.getDefault()); + public String toDefaultValue(Schema p) { + if (p instanceof IntegerSchema || p instanceof NumberSchema || p instanceof BooleanSchema) { + if (p.getDefault() != null) { + return p.getDefault().toString(); + } + } else if (p instanceof StringSchema) { + StringSchema sp = (StringSchema) p; + if (sp.getDefault() != null) { + return "'" + escapeText(sp.getDefault()) + "'"; } - } - - if (schema.getDefault() != null) { - return schema.getDefault().toString(); } return null; @@ -401,15 +397,15 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String getSchemaType(Schema schema) { - String swaggerType = super.getSchemaType(schema); + String openAPIType = super.getSchemaType(schema); String type = null; - if (typeMapping.containsKey(swaggerType)) { - type = typeMapping.get(swaggerType); + if (typeMapping.containsKey(openAPIType)) { + type = typeMapping.get(openAPIType); if (languageSpecificPrimitives.contains(type)) { return type; } } else { - type = swaggerType; + type = openAPIType; } if (type == null) { diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index 6046199017..cc84c7ab17 100644 --- a/samples/client/petstore/ruby/README.md +++ b/samples/client/petstore/ruby/README.md @@ -56,12 +56,12 @@ require 'petstore' api_instance = Petstore::AnotherFakeApi.new -body = Petstore::Client.new # Client | client model +client = Petstore::Client.new # Client | client model begin #To test special tags - result = api_instance.test_special_tags(body) + result = api_instance.test_special_tags(client) p result rescue Petstore::ApiError => e puts "Exception when calling AnotherFakeApi->test_special_tags: #{e}" @@ -80,6 +80,7 @@ Class | Method | HTTP request | Description *Petstore::FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | *Petstore::FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | *Petstore::FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | +*Petstore::FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | *Petstore::FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model *Petstore::FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 *Petstore::FakeApi* | [**test_enum_parameters**](docs/FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters @@ -118,9 +119,11 @@ Class | Method | HTTP request | Description - [Petstore::ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) - [Petstore::ArrayTest](docs/ArrayTest.md) - [Petstore::Capitalization](docs/Capitalization.md) + - [Petstore::Cat](docs/Cat.md) - [Petstore::Category](docs/Category.md) - [Petstore::ClassModel](docs/ClassModel.md) - [Petstore::Client](docs/Client.md) + - [Petstore::Dog](docs/Dog.md) - [Petstore::EnumArrays](docs/EnumArrays.md) - [Petstore::EnumClass](docs/EnumClass.md) - [Petstore::EnumTest](docs/EnumTest.md) @@ -144,8 +147,6 @@ Class | Method | HTTP request | Description - [Petstore::SpecialModelName](docs/SpecialModelName.md) - [Petstore::Tag](docs/Tag.md) - [Petstore::User](docs/User.md) - - [Petstore::Cat](docs/Cat.md) - - [Petstore::Dog](docs/Dog.md) ## Documentation for Authorization diff --git a/samples/client/petstore/ruby/docs/AnotherFakeApi.md b/samples/client/petstore/ruby/docs/AnotherFakeApi.md index a198df230e..bb5de8285a 100644 --- a/samples/client/petstore/ruby/docs/AnotherFakeApi.md +++ b/samples/client/petstore/ruby/docs/AnotherFakeApi.md @@ -8,7 +8,7 @@ Method | HTTP request | Description # **test_special_tags** -> Client test_special_tags(body) +> Client test_special_tags(client) To test special tags @@ -21,12 +21,12 @@ require 'petstore' api_instance = Petstore::AnotherFakeApi.new -body = Petstore::Client.new # Client | client model +client = Petstore::Client.new # Client | client model begin #To test special tags - result = api_instance.test_special_tags(body) + result = api_instance.test_special_tags(client) p result rescue Petstore::ApiError => e puts "Exception when calling AnotherFakeApi->test_special_tags: #{e}" @@ -37,7 +37,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Client**](Client.md)| client model | + **client** | [**Client**](Client.md)| client model | ### Return type diff --git a/samples/client/petstore/ruby/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/ruby/docs/ArrayOfArrayOfNumberOnly.md index 003cf9a8d6..6858436e42 100644 --- a/samples/client/petstore/ruby/docs/ArrayOfArrayOfNumberOnly.md +++ b/samples/client/petstore/ruby/docs/ArrayOfArrayOfNumberOnly.md @@ -3,6 +3,6 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**array_array_number** | **Array<Array<Float>>** | | [optional] +**array_array_number** | **Array<Array<BigDecimal>>** | | [optional] diff --git a/samples/client/petstore/ruby/docs/ArrayOfNumberOnly.md b/samples/client/petstore/ruby/docs/ArrayOfNumberOnly.md index c2b9fada4f..52487399a4 100644 --- a/samples/client/petstore/ruby/docs/ArrayOfNumberOnly.md +++ b/samples/client/petstore/ruby/docs/ArrayOfNumberOnly.md @@ -3,6 +3,6 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**array_number** | **Array<Float>** | | [optional] +**array_number** | [**Array<BigDecimal>**](BigDecimal.md) | | [optional] diff --git a/samples/client/petstore/ruby/docs/FakeApi.md b/samples/client/petstore/ruby/docs/FakeApi.md index cd4df08108..7842f6f681 100644 --- a/samples/client/petstore/ruby/docs/FakeApi.md +++ b/samples/client/petstore/ruby/docs/FakeApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**fake_outer_composite_serialize**](FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | [**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | [**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | +[**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | [**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model [**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**test_enum_parameters**](FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters @@ -16,7 +17,7 @@ Method | HTTP request | Description # **fake_outer_boolean_serialize** -> OuterBoolean fake_outer_boolean_serialize(opts) +> OuterBoolean fake_outer_boolean_serialize() @@ -29,12 +30,9 @@ require 'petstore' api_instance = Petstore::FakeApi.new -opts = { - body: Petstore::OuterBoolean.new # OuterBoolean | Input boolean as post body -} begin - result = api_instance.fake_outer_boolean_serialize(opts) + result = api_instance.fake_outer_boolean_serialize() p result rescue Petstore::ApiError => e puts "Exception when calling FakeApi->fake_outer_boolean_serialize: #{e}" @@ -45,7 +43,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**OuterBoolean**](OuterBoolean.md)| Input boolean as post body | [optional] + **UNKNOWN_PARAM_NAME** | [****](.md)| Input boolean as post body | [optional] ### Return type @@ -57,13 +55,13 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined + - **Content-Type**: */* + - **Accept**: */* # **fake_outer_composite_serialize** -> OuterComposite fake_outer_composite_serialize(opts) +> OuterComposite fake_outer_composite_serialize() @@ -76,12 +74,9 @@ require 'petstore' api_instance = Petstore::FakeApi.new -opts = { - body: Petstore::OuterComposite.new # OuterComposite | Input composite as post body -} begin - result = api_instance.fake_outer_composite_serialize(opts) + result = api_instance.fake_outer_composite_serialize() p result rescue Petstore::ApiError => e puts "Exception when calling FakeApi->fake_outer_composite_serialize: #{e}" @@ -92,7 +87,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + **outer_composite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] ### Return type @@ -104,13 +99,13 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined + - **Content-Type**: */* + - **Accept**: */* # **fake_outer_number_serialize** -> OuterNumber fake_outer_number_serialize(opts) +> OuterNumber fake_outer_number_serialize() @@ -123,12 +118,9 @@ require 'petstore' api_instance = Petstore::FakeApi.new -opts = { - body: Petstore::OuterNumber.new # OuterNumber | Input number as post body -} begin - result = api_instance.fake_outer_number_serialize(opts) + result = api_instance.fake_outer_number_serialize() p result rescue Petstore::ApiError => e puts "Exception when calling FakeApi->fake_outer_number_serialize: #{e}" @@ -139,7 +131,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**OuterNumber**](OuterNumber.md)| Input number as post body | [optional] + **UNKNOWN_PARAM_NAME** | [****](.md)| Input number as post body | [optional] ### Return type @@ -151,13 +143,13 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined + - **Content-Type**: */* + - **Accept**: */* # **fake_outer_string_serialize** -> OuterString fake_outer_string_serialize(opts) +> OuterString fake_outer_string_serialize() @@ -170,12 +162,9 @@ require 'petstore' api_instance = Petstore::FakeApi.new -opts = { - body: Petstore::OuterString.new # OuterString | Input string as post body -} begin - result = api_instance.fake_outer_string_serialize(opts) + result = api_instance.fake_outer_string_serialize() p result rescue Petstore::ApiError => e puts "Exception when calling FakeApi->fake_outer_string_serialize: #{e}" @@ -186,7 +175,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**OuterString**](OuterString.md)| Input string as post body | [optional] + **UNKNOWN_PARAM_NAME** | [****](.md)| Input string as post body | [optional] ### Return type @@ -198,13 +187,59 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: */* + - **Accept**: */* + + + +# **test_body_with_query_params** +> test_body_with_query_params(query, user) + + + +### Example +```ruby +# load the gem +require 'petstore' + +api_instance = Petstore::FakeApi.new + +query = 'query_example' # String | + +user = Petstore::User.new # User | + + +begin + api_instance.test_body_with_query_params(query, user) +rescue Petstore::ApiError => e + puts "Exception when calling FakeApi->test_body_with_query_params: #{e}" +end +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query** | **String**| | + **user** | [**User**](User.md)| | + +### Return type + +nil (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json - **Accept**: Not defined # **test_client_model** -> Client test_client_model(body) +> Client test_client_model(client) To test \"client\" model @@ -217,12 +252,12 @@ require 'petstore' api_instance = Petstore::FakeApi.new -body = Petstore::Client.new # Client | client model +client = Petstore::Client.new # Client | client model begin #To test \"client\" model - result = api_instance.test_client_model(body) + result = api_instance.test_client_model(client) p result rescue Petstore::ApiError => e puts "Exception when calling FakeApi->test_client_model: #{e}" @@ -233,7 +268,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Client**](Client.md)| client model | + **client** | [**Client**](Client.md)| client model | ### Return type @@ -251,7 +286,7 @@ No authorization required # **test_endpoint_parameters** -> test_endpoint_parameters(number, double, pattern_without_delimiter, byte, opts) +> test_endpoint_parameters(UNKNOWN_PARAM_NAME) Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -270,30 +305,12 @@ end api_instance = Petstore::FakeApi.new -number = 8.14 # Float | None +UNKNOWN_PARAM_NAME = Petstore::null.new # | -double = 1.2 # Float | None - -pattern_without_delimiter = 'pattern_without_delimiter_example' # String | None - -byte = 'B' # String | None - -opts = { - integer: 56, # Integer | None - int32: 56, # Integer | None - int64: 789, # Integer | None - float: 3.4, # Float | None - string: 'string_example', # String | None - binary: 'B', # String | None - date: Date.parse('2013-10-20'), # Date | None - date_time: DateTime.parse('2013-10-20T19:20:30+01:00'), # DateTime | None - password: 'password_example', # String | None - callback: 'callback_example' # String | None -} begin #Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, opts) + api_instance.test_endpoint_parameters(UNKNOWN_PARAM_NAME) rescue Petstore::ApiError => e puts "Exception when calling FakeApi->test_endpoint_parameters: #{e}" end @@ -303,20 +320,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **number** | **Float**| None | - **double** | **Float**| None | - **pattern_without_delimiter** | **String**| None | - **byte** | **String**| None | - **integer** | **Integer**| None | [optional] - **int32** | **Integer**| None | [optional] - **int64** | **Integer**| None | [optional] - **float** | **Float**| None | [optional] - **string** | **String**| None | [optional] - **binary** | **String**| None | [optional] - **date** | **Date**| None | [optional] - **date_time** | **DateTime**| None | [optional] - **password** | **String**| None | [optional] - **callback** | **String**| None | [optional] + **UNKNOWN_PARAM_NAME** | [****](.md)| | ### Return type @@ -329,12 +333,12 @@ nil (empty response body) ### HTTP request headers - **Content-Type**: application/xml; charset=utf-8, application/json; charset=utf-8 - - **Accept**: application/xml; charset=utf-8, application/json; charset=utf-8 + - **Accept**: Not defined # **test_enum_parameters** -> test_enum_parameters(opts) +> test_enum_parameters() To test enum parameters @@ -347,20 +351,10 @@ require 'petstore' api_instance = Petstore::FakeApi.new -opts = { - enum_form_string_array: ['enum_form_string_array_example'], # Array | Form parameter enum test (string array) - enum_form_string: '-efg', # String | Form parameter enum test (string) - enum_header_string_array: ['enum_header_string_array_example'], # Array | Header parameter enum test (string array) - enum_header_string: '-efg', # String | Header parameter enum test (string) - enum_query_string_array: ['enum_query_string_array_example'], # Array | Query parameter enum test (string array) - enum_query_string: '-efg', # String | Query parameter enum test (string) - enum_query_integer: 56, # Integer | Query parameter enum test (double) - enum_query_double: 1.2 # Float | Query parameter enum test (double) -} begin #To test enum parameters - api_instance.test_enum_parameters(opts) + api_instance.test_enum_parameters() rescue Petstore::ApiError => e puts "Exception when calling FakeApi->test_enum_parameters: #{e}" end @@ -370,14 +364,13 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **enum_form_string_array** | [**Array<String>**](String.md)| Form parameter enum test (string array) | [optional] - **enum_form_string** | **String**| Form parameter enum test (string) | [optional] [default to -efg] **enum_header_string_array** | [**Array<String>**](String.md)| Header parameter enum test (string array) | [optional] - **enum_header_string** | **String**| Header parameter enum test (string) | [optional] [default to -efg] + **enum_header_string** | **String**| Header parameter enum test (string) | [optional] **enum_query_string_array** | [**Array<String>**](String.md)| Query parameter enum test (string array) | [optional] - **enum_query_string** | **String**| Query parameter enum test (string) | [optional] [default to -efg] + **enum_query_string** | **String**| Query parameter enum test (string) | [optional] **enum_query_integer** | **Integer**| Query parameter enum test (double) | [optional] **enum_query_double** | **Float**| Query parameter enum test (double) | [optional] + **UNKNOWN_PARAM_NAME** | [****](.md)| | [optional] ### Return type @@ -390,17 +383,15 @@ No authorization required ### HTTP request headers - **Content-Type**: */* - - **Accept**: */* + - **Accept**: Not defined # **test_inline_additional_properties** -> test_inline_additional_properties(param) +> test_inline_additional_properties(UNKNOWN_PARAM_NAME) test inline additionalProperties - - ### Example ```ruby # load the gem @@ -408,12 +399,12 @@ require 'petstore' api_instance = Petstore::FakeApi.new -param = nil # Object | request body +UNKNOWN_PARAM_NAME = Petstore::null.new # | request body begin #test inline additionalProperties - api_instance.test_inline_additional_properties(param) + api_instance.test_inline_additional_properties(UNKNOWN_PARAM_NAME) rescue Petstore::ApiError => e puts "Exception when calling FakeApi->test_inline_additional_properties: #{e}" end @@ -423,7 +414,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **param** | **Object**| request body | + **UNKNOWN_PARAM_NAME** | [****](.md)| request body | ### Return type @@ -441,12 +432,10 @@ No authorization required # **test_json_form_data** -> test_json_form_data(param, param2) +> test_json_form_data(UNKNOWN_PARAM_NAME) test json serialization of form data - - ### Example ```ruby # load the gem @@ -454,14 +443,12 @@ require 'petstore' api_instance = Petstore::FakeApi.new -param = 'param_example' # String | field1 - -param2 = 'param2_example' # String | field2 +UNKNOWN_PARAM_NAME = Petstore::null.new # | begin #test json serialization of form data - api_instance.test_json_form_data(param, param2) + api_instance.test_json_form_data(UNKNOWN_PARAM_NAME) rescue Petstore::ApiError => e puts "Exception when calling FakeApi->test_json_form_data: #{e}" end @@ -471,8 +458,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **param** | **String**| field1 | - **param2** | **String**| field2 | + **UNKNOWN_PARAM_NAME** | [****](.md)| | ### Return type diff --git a/samples/client/petstore/ruby/docs/FakeClassnameTags123Api.md b/samples/client/petstore/ruby/docs/FakeClassnameTags123Api.md index 1237031fb0..f4eee7c462 100644 --- a/samples/client/petstore/ruby/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/ruby/docs/FakeClassnameTags123Api.md @@ -8,7 +8,7 @@ Method | HTTP request | Description # **test_classname** -> Client test_classname(body) +> Client test_classname(client) To test class name in snake case @@ -28,12 +28,12 @@ end api_instance = Petstore::FakeClassnameTags123Api.new -body = Petstore::Client.new # Client | client model +client = Petstore::Client.new # Client | client model begin #To test class name in snake case - result = api_instance.test_classname(body) + result = api_instance.test_classname(client) p result rescue Petstore::ApiError => e puts "Exception when calling FakeClassnameTags123Api->test_classname: #{e}" @@ -44,7 +44,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Client**](Client.md)| client model | + **client** | [**Client**](Client.md)| client model | ### Return type diff --git a/samples/client/petstore/ruby/docs/FormatTest.md b/samples/client/petstore/ruby/docs/FormatTest.md index 79cf9b5a86..e1b4cf345a 100644 --- a/samples/client/petstore/ruby/docs/FormatTest.md +++ b/samples/client/petstore/ruby/docs/FormatTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **integer** | **Integer** | | [optional] **int32** | **Integer** | | [optional] **int64** | **Integer** | | [optional] -**number** | **Float** | | +**number** | [**BigDecimal**](BigDecimal.md) | | **float** | **Float** | | [optional] **double** | **Float** | | [optional] **string** | **String** | | [optional] diff --git a/samples/client/petstore/ruby/docs/NumberOnly.md b/samples/client/petstore/ruby/docs/NumberOnly.md index 4be8a12a79..b493d92b91 100644 --- a/samples/client/petstore/ruby/docs/NumberOnly.md +++ b/samples/client/petstore/ruby/docs/NumberOnly.md @@ -3,6 +3,6 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**just_number** | **Float** | | [optional] +**just_number** | [**BigDecimal**](BigDecimal.md) | | [optional] diff --git a/samples/client/petstore/ruby/docs/PetApi.md b/samples/client/petstore/ruby/docs/PetApi.md index b76ad396d8..a876994555 100644 --- a/samples/client/petstore/ruby/docs/PetApi.md +++ b/samples/client/petstore/ruby/docs/PetApi.md @@ -15,12 +15,10 @@ Method | HTTP request | Description # **add_pet** -> add_pet(body) +> add_pet(pet) Add a new pet to the store - - ### Example ```ruby # load the gem @@ -33,12 +31,12 @@ end api_instance = Petstore::PetApi.new -body = Petstore::Pet.new # Pet | Pet object that needs to be added to the store +pet = Petstore::Pet.new # Pet | Pet object that needs to be added to the store begin #Add a new pet to the store - api_instance.add_pet(body) + api_instance.add_pet(pet) rescue Petstore::ApiError => e puts "Exception when calling PetApi->add_pet: #{e}" end @@ -48,7 +46,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -61,17 +59,15 @@ nil (empty response body) ### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: application/xml, application/json + - **Accept**: Not defined # **delete_pet** -> delete_pet(pet_id, opts) +> delete_pet(pet_id) Deletes a pet - - ### Example ```ruby # load the gem @@ -86,13 +82,10 @@ api_instance = Petstore::PetApi.new pet_id = 789 # Integer | Pet id to delete -opts = { - api_key: 'api_key_example' # String | -} begin #Deletes a pet - api_instance.delete_pet(pet_id, opts) + api_instance.delete_pet(pet_id) rescue Petstore::ApiError => e puts "Exception when calling PetApi->delete_pet: #{e}" end @@ -116,7 +109,7 @@ nil (empty response body) ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: Not defined @@ -279,12 +272,10 @@ Name | Type | Description | Notes # **update_pet** -> update_pet(body) +> update_pet(pet) Update an existing pet - - ### Example ```ruby # load the gem @@ -297,12 +288,12 @@ end api_instance = Petstore::PetApi.new -body = Petstore::Pet.new # Pet | Pet object that needs to be added to the store +pet = Petstore::Pet.new # Pet | Pet object that needs to be added to the store begin #Update an existing pet - api_instance.update_pet(body) + api_instance.update_pet(pet) rescue Petstore::ApiError => e puts "Exception when calling PetApi->update_pet: #{e}" end @@ -312,7 +303,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -325,17 +316,15 @@ nil (empty response body) ### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: application/xml, application/json + - **Accept**: Not defined # **update_pet_with_form** -> update_pet_with_form(pet_id, opts) +> update_pet_with_form(pet_id) Updates a pet in the store with form data - - ### Example ```ruby # load the gem @@ -350,14 +339,10 @@ api_instance = Petstore::PetApi.new pet_id = 789 # Integer | ID of pet that needs to be updated -opts = { - name: 'name_example', # String | Updated name of the pet - status: 'status_example' # String | Updated status of the pet -} begin #Updates a pet in the store with form data - api_instance.update_pet_with_form(pet_id, opts) + api_instance.update_pet_with_form(pet_id) rescue Petstore::ApiError => e puts "Exception when calling PetApi->update_pet_with_form: #{e}" end @@ -382,17 +367,15 @@ nil (empty response body) ### HTTP request headers - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: application/xml, application/json + - **Accept**: Not defined # **upload_file** -> ApiResponse upload_file(pet_id, opts) +> ApiResponse upload_file(pet_id) uploads an image - - ### Example ```ruby # load the gem @@ -407,14 +390,10 @@ api_instance = Petstore::PetApi.new pet_id = 789 # Integer | ID of pet to update -opts = { - additional_metadata: 'additional_metadata_example', # String | Additional data to pass to server - file: File.new('/path/to/file.txt') # File | file to upload -} begin #uploads an image - result = api_instance.upload_file(pet_id, opts) + result = api_instance.upload_file(pet_id) p result rescue Petstore::ApiError => e puts "Exception when calling PetApi->upload_file: #{e}" diff --git a/samples/client/petstore/ruby/docs/StoreApi.md b/samples/client/petstore/ruby/docs/StoreApi.md index 8a6453c649..d24d9fcc4e 100644 --- a/samples/client/petstore/ruby/docs/StoreApi.md +++ b/samples/client/petstore/ruby/docs/StoreApi.md @@ -52,7 +52,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: Not defined @@ -152,12 +152,10 @@ No authorization required # **place_order** -> Order place_order(body) +> Order place_order(order) Place an order for a pet - - ### Example ```ruby # load the gem @@ -165,12 +163,12 @@ require 'petstore' api_instance = Petstore::StoreApi.new -body = Petstore::Order.new # Order | order placed for purchasing the pet +order = Petstore::Order.new # Order | order placed for purchasing the pet begin #Place an order for a pet - result = api_instance.place_order(body) + result = api_instance.place_order(order) p result rescue Petstore::ApiError => e puts "Exception when calling StoreApi->place_order: #{e}" @@ -181,7 +179,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Order**](Order.md)| order placed for purchasing the pet | + **order** | [**Order**](Order.md)| order placed for purchasing the pet | ### Return type @@ -193,7 +191,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: */* - **Accept**: application/xml, application/json diff --git a/samples/client/petstore/ruby/docs/UserApi.md b/samples/client/petstore/ruby/docs/UserApi.md index 3c2da68691..c4c2f9d700 100644 --- a/samples/client/petstore/ruby/docs/UserApi.md +++ b/samples/client/petstore/ruby/docs/UserApi.md @@ -15,7 +15,7 @@ Method | HTTP request | Description # **create_user** -> create_user(body) +> create_user(user) Create user @@ -28,12 +28,12 @@ require 'petstore' api_instance = Petstore::UserApi.new -body = Petstore::User.new # User | Created user object +user = Petstore::User.new # User | Created user object begin #Create user - api_instance.create_user(body) + api_instance.create_user(user) rescue Petstore::ApiError => e puts "Exception when calling UserApi->create_user: #{e}" end @@ -43,7 +43,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**User**](User.md)| Created user object | + **user** | [**User**](User.md)| Created user object | ### Return type @@ -55,18 +55,16 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Content-Type**: */* + - **Accept**: Not defined # **create_users_with_array_input** -> create_users_with_array_input(body) +> create_users_with_array_input(user) Creates list of users with given input array - - ### Example ```ruby # load the gem @@ -74,12 +72,12 @@ require 'petstore' api_instance = Petstore::UserApi.new -body = [Petstore::User.new] # Array | List of user object +user = [Petstore::User.new] # Array | List of user object begin #Creates list of users with given input array - api_instance.create_users_with_array_input(body) + api_instance.create_users_with_array_input(user) rescue Petstore::ApiError => e puts "Exception when calling UserApi->create_users_with_array_input: #{e}" end @@ -89,7 +87,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Array<User>**](User.md)| List of user object | + **user** | [**Array<User>**](User.md)| List of user object | ### Return type @@ -101,18 +99,16 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Content-Type**: */* + - **Accept**: Not defined # **create_users_with_list_input** -> create_users_with_list_input(body) +> create_users_with_list_input(user) Creates list of users with given input array - - ### Example ```ruby # load the gem @@ -120,12 +116,12 @@ require 'petstore' api_instance = Petstore::UserApi.new -body = [Petstore::User.new] # Array | List of user object +user = [Petstore::User.new] # Array | List of user object begin #Creates list of users with given input array - api_instance.create_users_with_list_input(body) + api_instance.create_users_with_list_input(user) rescue Petstore::ApiError => e puts "Exception when calling UserApi->create_users_with_list_input: #{e}" end @@ -135,7 +131,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Array<User>**](User.md)| List of user object | + **user** | [**Array<User>**](User.md)| List of user object | ### Return type @@ -147,8 +143,8 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Content-Type**: */* + - **Accept**: Not defined @@ -194,7 +190,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: Not defined @@ -203,8 +199,6 @@ No authorization required Get user by user name - - ### Example ```ruby # load the gem @@ -250,8 +244,6 @@ No authorization required Logs user into the system - - ### Example ```ruby # load the gem @@ -300,8 +292,6 @@ No authorization required Logs out current logged in user session - - ### Example ```ruby # load the gem @@ -331,12 +321,12 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: Not defined # **update_user** -> update_user(username, body) +> update_user(username, user) Updated user @@ -351,12 +341,12 @@ api_instance = Petstore::UserApi.new username = 'username_example' # String | name that need to be deleted -body = Petstore::User.new # User | Updated user object +user = Petstore::User.new # User | Updated user object begin #Updated user - api_instance.update_user(username, body) + api_instance.update_user(username, user) rescue Petstore::ApiError => e puts "Exception when calling UserApi->update_user: #{e}" end @@ -367,7 +357,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **username** | **String**| name that need to be deleted | - **body** | [**User**](User.md)| Updated user object | + **user** | [**User**](User.md)| Updated user object | ### Return type @@ -379,8 +369,8 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Content-Type**: */* + - **Accept**: Not defined diff --git a/samples/client/petstore/ruby/lib/petstore.rb b/samples/client/petstore/ruby/lib/petstore.rb index 3fdda9d94d..3dd54e405e 100644 --- a/samples/client/petstore/ruby/lib/petstore.rb +++ b/samples/client/petstore/ruby/lib/petstore.rb @@ -25,9 +25,11 @@ require 'petstore/models/array_of_array_of_number_only' require 'petstore/models/array_of_number_only' require 'petstore/models/array_test' require 'petstore/models/capitalization' +require 'petstore/models/cat' require 'petstore/models/category' require 'petstore/models/class_model' require 'petstore/models/client' +require 'petstore/models/dog' require 'petstore/models/enum_arrays' require 'petstore/models/enum_class' require 'petstore/models/enum_test' @@ -51,8 +53,6 @@ require 'petstore/models/read_only_first' require 'petstore/models/special_model_name' require 'petstore/models/tag' require 'petstore/models/user' -require 'petstore/models/cat' -require 'petstore/models/dog' # APIs require 'petstore/api/another_fake_api' 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 46538f3ecc..5bae9d7691 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 @@ -21,26 +21,26 @@ module Petstore end # To test special tags # To test special tags - # @param body client model + # @param client client model # @param [Hash] opts the optional parameters # @return [Client] - def test_special_tags(body, opts = {}) - data, _status_code, _headers = test_special_tags_with_http_info(body, opts) + def test_special_tags(client, opts = {}) + data, _status_code, _headers = test_special_tags_with_http_info(client, opts) data end # To test special tags # To test special tags - # @param body client model + # @param client client model # @param [Hash] opts the optional parameters # @return [Array<(Client, Fixnum, Hash)>] Client data, response status code and response headers - def test_special_tags_with_http_info(body, opts = {}) + def test_special_tags_with_http_info(client, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AnotherFakeApi.test_special_tags ...' end - # verify the required parameter 'body' is set - if @api_client.config.client_side_validation && body.nil? - fail ArgumentError, "Missing the required parameter 'body' when calling AnotherFakeApi.test_special_tags" + # verify the required parameter 'client' is set + if @api_client.config.client_side_validation && client.nil? + fail ArgumentError, "Missing the required parameter 'client' when calling AnotherFakeApi.test_special_tags" end # resource path local_var_path = '/another-fake/dummy' @@ -59,7 +59,7 @@ module Petstore form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(body) + post_body = @api_client.object_to_http_body(client) auth_names = [] data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, :header_params => header_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 3bb14d1aac..8a8438eaa0 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb @@ -21,7 +21,7 @@ module Petstore end # Test serialization of outer boolean types # @param [Hash] opts the optional parameters - # @option opts [OuterBoolean] :body Input boolean as post body + # @option opts [] :UNKNOWN_PARAM_NAME Input boolean as post body # @return [OuterBoolean] def fake_outer_boolean_serialize(opts = {}) data, _status_code, _headers = fake_outer_boolean_serialize_with_http_info(opts) @@ -30,7 +30,7 @@ module Petstore # Test serialization of outer boolean types # @param [Hash] opts the optional parameters - # @option opts [OuterBoolean] :body Input boolean as post body + # @option opts [] :UNKNOWN_PARAM_NAME Input boolean as post body # @return [Array<(OuterBoolean, Fixnum, Hash)>] OuterBoolean data, response status code and response headers def fake_outer_boolean_serialize_with_http_info(opts = {}) if @api_client.config.debugging @@ -44,12 +44,16 @@ module Petstore # header parameters header_params = {} + # 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(['*/*']) # form parameters form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(opts[:'body']) + post_body = @api_client.object_to_http_body(opts[:'UNKNOWN_PARAM_NAME']) auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, @@ -65,7 +69,7 @@ module Petstore end # Test serialization of object with outer number type # @param [Hash] opts the optional parameters - # @option opts [OuterComposite] :body Input composite as post body + # @option opts [OuterComposite] :outer_composite Input composite as post body # @return [OuterComposite] def fake_outer_composite_serialize(opts = {}) data, _status_code, _headers = fake_outer_composite_serialize_with_http_info(opts) @@ -74,7 +78,7 @@ module Petstore # Test serialization of object with outer number type # @param [Hash] opts the optional parameters - # @option opts [OuterComposite] :body Input composite as post body + # @option opts [OuterComposite] :outer_composite Input composite as post body # @return [Array<(OuterComposite, Fixnum, Hash)>] OuterComposite data, response status code and response headers def fake_outer_composite_serialize_with_http_info(opts = {}) if @api_client.config.debugging @@ -88,12 +92,16 @@ module Petstore # header parameters header_params = {} + # 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(['*/*']) # form parameters form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(opts[:'body']) + post_body = @api_client.object_to_http_body(opts[:'outer_composite']) auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, @@ -109,7 +117,7 @@ module Petstore end # Test serialization of outer number types # @param [Hash] opts the optional parameters - # @option opts [OuterNumber] :body Input number as post body + # @option opts [] :UNKNOWN_PARAM_NAME Input number as post body # @return [OuterNumber] def fake_outer_number_serialize(opts = {}) data, _status_code, _headers = fake_outer_number_serialize_with_http_info(opts) @@ -118,7 +126,7 @@ module Petstore # Test serialization of outer number types # @param [Hash] opts the optional parameters - # @option opts [OuterNumber] :body Input number as post body + # @option opts [] :UNKNOWN_PARAM_NAME Input number as post body # @return [Array<(OuterNumber, Fixnum, Hash)>] OuterNumber data, response status code and response headers def fake_outer_number_serialize_with_http_info(opts = {}) if @api_client.config.debugging @@ -132,12 +140,16 @@ module Petstore # header parameters header_params = {} + # 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(['*/*']) # form parameters form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(opts[:'body']) + post_body = @api_client.object_to_http_body(opts[:'UNKNOWN_PARAM_NAME']) auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, @@ -153,7 +165,7 @@ module Petstore end # Test serialization of outer string types # @param [Hash] opts the optional parameters - # @option opts [OuterString] :body Input string as post body + # @option opts [] :UNKNOWN_PARAM_NAME Input string as post body # @return [OuterString] def fake_outer_string_serialize(opts = {}) data, _status_code, _headers = fake_outer_string_serialize_with_http_info(opts) @@ -162,7 +174,7 @@ module Petstore # Test serialization of outer string types # @param [Hash] opts the optional parameters - # @option opts [OuterString] :body Input string as post body + # @option opts [] :UNKNOWN_PARAM_NAME Input string as post body # @return [Array<(OuterString, Fixnum, Hash)>] OuterString data, response status code and response headers def fake_outer_string_serialize_with_http_info(opts = {}) if @api_client.config.debugging @@ -176,12 +188,16 @@ module Petstore # header parameters header_params = {} + # 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(['*/*']) # form parameters form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(opts[:'body']) + post_body = @api_client.object_to_http_body(opts[:'UNKNOWN_PARAM_NAME']) auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, @@ -195,28 +211,82 @@ module Petstore end return data, status_code, headers end + # @param query + # @param user + # @param [Hash] opts the optional parameters + # @return [nil] + def test_body_with_query_params(query, user, opts = {}) + test_body_with_query_params_with_http_info(query, user, opts) + nil + end + + # @param query + # @param user + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers + def test_body_with_query_params_with_http_info(query, user, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FakeApi.test_body_with_query_params ...' + end + # verify the required parameter 'query' is set + if @api_client.config.client_side_validation && query.nil? + fail ArgumentError, "Missing the required parameter 'query' when calling FakeApi.test_body_with_query_params" + end + # verify the required parameter 'user' is set + if @api_client.config.client_side_validation && user.nil? + fail ArgumentError, "Missing the required parameter 'user' when calling FakeApi.test_body_with_query_params" + end + # resource path + local_var_path = '/fake/body-with-query-params' + + # query parameters + query_params = {} + query_params[:'query'] = query + + # header parameters + header_params = {} + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = @api_client.object_to_http_body(user) + auth_names = [] + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FakeApi#test_body_with_query_params\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end # To test \"client\" model # To test \"client\" model - # @param body client model + # @param client client model # @param [Hash] opts the optional parameters # @return [Client] - def test_client_model(body, opts = {}) - data, _status_code, _headers = test_client_model_with_http_info(body, opts) + def test_client_model(client, opts = {}) + data, _status_code, _headers = test_client_model_with_http_info(client, opts) data end # To test \"client\" model # To test \"client\" model - # @param body client model + # @param client client model # @param [Hash] opts the optional parameters # @return [Array<(Client, Fixnum, Hash)>] Client data, response status code and response headers - def test_client_model_with_http_info(body, opts = {}) + def test_client_model_with_http_info(client, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FakeApi.test_client_model ...' end - # verify the required parameter 'body' is set - if @api_client.config.client_side_validation && body.nil? - fail ArgumentError, "Missing the required parameter 'body' when calling FakeApi.test_client_model" + # verify the required parameter 'client' is set + if @api_client.config.client_side_validation && client.nil? + fail ArgumentError, "Missing the required parameter 'client' when calling FakeApi.test_client_model" end # resource path local_var_path = '/fake' @@ -235,7 +305,7 @@ module Petstore form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(body) + post_body = @api_client.object_to_http_body(client) auth_names = [] data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, :header_params => header_params, @@ -251,117 +321,27 @@ module Petstore end # Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - # @param number None - # @param double None - # @param pattern_without_delimiter None - # @param byte None + # @param UNKNOWN_PARAM_NAME # @param [Hash] opts the optional parameters - # @option opts [Integer] :integer None - # @option opts [Integer] :int32 None - # @option opts [Integer] :int64 None - # @option opts [Float] :float None - # @option opts [String] :string None - # @option opts [String] :binary None - # @option opts [Date] :date None - # @option opts [DateTime] :date_time None - # @option opts [String] :password None - # @option opts [String] :callback None # @return [nil] - def test_endpoint_parameters(number, double, pattern_without_delimiter, byte, opts = {}) - test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, opts) + def test_endpoint_parameters(UNKNOWN_PARAM_NAME, opts = {}) + test_endpoint_parameters_with_http_info(UNKNOWN_PARAM_NAME, opts) nil end # Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - # @param number None - # @param double None - # @param pattern_without_delimiter None - # @param byte None + # @param UNKNOWN_PARAM_NAME # @param [Hash] opts the optional parameters - # @option opts [Integer] :integer None - # @option opts [Integer] :int32 None - # @option opts [Integer] :int64 None - # @option opts [Float] :float None - # @option opts [String] :string None - # @option opts [String] :binary None - # @option opts [Date] :date None - # @option opts [DateTime] :date_time None - # @option opts [String] :password None - # @option opts [String] :callback None # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers - def test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, opts = {}) + def test_endpoint_parameters_with_http_info(UNKNOWN_PARAM_NAME, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FakeApi.test_endpoint_parameters ...' end - # verify the required parameter 'number' is set - if @api_client.config.client_side_validation && number.nil? - fail ArgumentError, "Missing the required parameter 'number' when calling FakeApi.test_endpoint_parameters" + # verify the required parameter 'UNKNOWN_PARAM_NAME' is set + if @api_client.config.client_side_validation && UNKNOWN_PARAM_NAME.nil? + fail ArgumentError, "Missing the required parameter 'UNKNOWN_PARAM_NAME' when calling FakeApi.test_endpoint_parameters" end - if @api_client.config.client_side_validation && number > 543.2 - fail ArgumentError, 'invalid value for "number" when calling FakeApi.test_endpoint_parameters, must be smaller than or equal to 543.2.' - end - - if @api_client.config.client_side_validation && number < 32.1 - fail ArgumentError, 'invalid value for "number" when calling FakeApi.test_endpoint_parameters, must be greater than or equal to 32.1.' - end - - # verify the required parameter 'double' is set - if @api_client.config.client_side_validation && double.nil? - fail ArgumentError, "Missing the required parameter 'double' when calling FakeApi.test_endpoint_parameters" - end - if @api_client.config.client_side_validation && double > 123.4 - fail ArgumentError, 'invalid value for "double" when calling FakeApi.test_endpoint_parameters, must be smaller than or equal to 123.4.' - end - - if @api_client.config.client_side_validation && double < 67.8 - fail ArgumentError, 'invalid value for "double" when calling FakeApi.test_endpoint_parameters, must be greater than or equal to 67.8.' - end - - # verify the required parameter 'pattern_without_delimiter' is set - if @api_client.config.client_side_validation && pattern_without_delimiter.nil? - fail ArgumentError, "Missing the required parameter 'pattern_without_delimiter' when calling FakeApi.test_endpoint_parameters" - end - if @api_client.config.client_side_validation && pattern_without_delimiter !~ Regexp.new(/^[A-Z].*/) - fail ArgumentError, "invalid value for 'pattern_without_delimiter' when calling FakeApi.test_endpoint_parameters, must conform to the pattern /^[A-Z].*/." - end - - # verify the required parameter 'byte' is set - if @api_client.config.client_side_validation && byte.nil? - fail ArgumentError, "Missing the required parameter 'byte' when calling FakeApi.test_endpoint_parameters" - end - if @api_client.config.client_side_validation && !opts[:'integer'].nil? && opts[:'integer'] > 100 - fail ArgumentError, 'invalid value for "opts[:"integer"]" when calling FakeApi.test_endpoint_parameters, must be smaller than or equal to 100.' - end - - if @api_client.config.client_side_validation && !opts[:'integer'].nil? && opts[:'integer'] < 10 - fail ArgumentError, 'invalid value for "opts[:"integer"]" when calling FakeApi.test_endpoint_parameters, must be greater than or equal to 10.' - end - - if @api_client.config.client_side_validation && !opts[:'int32'].nil? && opts[:'int32'] > 200 - fail ArgumentError, 'invalid value for "opts[:"int32"]" when calling FakeApi.test_endpoint_parameters, must be smaller than or equal to 200.' - end - - if @api_client.config.client_side_validation && !opts[:'int32'].nil? && opts[:'int32'] < 20 - fail ArgumentError, 'invalid value for "opts[:"int32"]" when calling FakeApi.test_endpoint_parameters, must be greater than or equal to 20.' - end - - if @api_client.config.client_side_validation && !opts[:'float'].nil? && opts[:'float'] > 987.6 - fail ArgumentError, 'invalid value for "opts[:"float"]" when calling FakeApi.test_endpoint_parameters, must be smaller than or equal to 987.6.' - end - - if @api_client.config.client_side_validation && !opts[:'string'].nil? && opts[:'string'] !~ Regexp.new(/[a-z]/i) - fail ArgumentError, "invalid value for 'opts[:\"string\"]' when calling FakeApi.test_endpoint_parameters, must conform to the pattern /[a-z]/i." - end - - if @api_client.config.client_side_validation && !opts[:'password'].nil? && opts[:'password'].to_s.length > 64 - fail ArgumentError, 'invalid value for "opts[:"password"]" when calling FakeApi.test_endpoint_parameters, the character length must be smaller than or equal to 64.' - end - - if @api_client.config.client_side_validation && !opts[:'password'].nil? && opts[:'password'].to_s.length < 10 - fail ArgumentError, 'invalid value for "opts[:"password"]" when calling FakeApi.test_endpoint_parameters, the character length must be great than or equal to 10.' - end - # resource path local_var_path = '/fake' @@ -370,30 +350,14 @@ module Petstore # header parameters header_params = {} - # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/xml; charset=utf-8', 'application/json; charset=utf-8']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/xml; charset=utf-8', 'application/json; charset=utf-8']) # form parameters form_params = {} - form_params['number'] = number - form_params['double'] = double - form_params['pattern_without_delimiter'] = pattern_without_delimiter - form_params['byte'] = byte - form_params['integer'] = opts[:'integer'] if !opts[:'integer'].nil? - form_params['int32'] = opts[:'int32'] if !opts[:'int32'].nil? - form_params['int64'] = opts[:'int64'] if !opts[:'int64'].nil? - form_params['float'] = opts[:'float'] if !opts[:'float'].nil? - form_params['string'] = opts[:'string'] if !opts[:'string'].nil? - form_params['binary'] = opts[:'binary'] if !opts[:'binary'].nil? - form_params['date'] = opts[:'date'] if !opts[:'date'].nil? - form_params['dateTime'] = opts[:'date_time'] if !opts[:'date_time'].nil? - form_params['password'] = opts[:'password'] if !opts[:'password'].nil? - form_params['callback'] = opts[:'callback'] if !opts[:'callback'].nil? # http body (model) - post_body = nil + post_body = @api_client.object_to_http_body(UNKNOWN_PARAM_NAME) auth_names = ['http_basic_test'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, @@ -409,14 +373,13 @@ module Petstore # To test enum parameters # To test enum parameters # @param [Hash] opts the optional parameters - # @option opts [Array] :enum_form_string_array Form parameter enum test (string array) - # @option opts [String] :enum_form_string Form parameter enum test (string) (default to -efg) # @option opts [Array] :enum_header_string_array Header parameter enum test (string array) - # @option opts [String] :enum_header_string Header parameter enum test (string) (default to -efg) + # @option opts [String] :enum_header_string Header parameter enum test (string) # @option opts [Array] :enum_query_string_array Query parameter enum test (string array) - # @option opts [String] :enum_query_string Query parameter enum test (string) (default to -efg) + # @option opts [String] :enum_query_string Query parameter enum test (string) # @option opts [Integer] :enum_query_integer Query parameter enum test (double) # @option opts [Float] :enum_query_double Query parameter enum test (double) + # @option opts [] :UNKNOWN_PARAM_NAME # @return [nil] def test_enum_parameters(opts = {}) test_enum_parameters_with_http_info(opts) @@ -426,33 +389,26 @@ module Petstore # To test enum parameters # To test enum parameters # @param [Hash] opts the optional parameters - # @option opts [Array] :enum_form_string_array Form parameter enum test (string array) - # @option opts [String] :enum_form_string Form parameter enum test (string) # @option opts [Array] :enum_header_string_array Header parameter enum test (string array) # @option opts [String] :enum_header_string Header parameter enum test (string) # @option opts [Array] :enum_query_string_array Query parameter enum test (string array) # @option opts [String] :enum_query_string Query parameter enum test (string) # @option opts [Integer] :enum_query_integer Query parameter enum test (double) # @option opts [Float] :enum_query_double Query parameter enum test (double) + # @option opts [] :UNKNOWN_PARAM_NAME # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def test_enum_parameters_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FakeApi.test_enum_parameters ...' end - if @api_client.config.client_side_validation && opts[:'enum_form_string_array'] && !opts[:'enum_form_string_array'].all? { |item| ['>', '$'].include?(item) } - fail ArgumentError, 'invalid value for "enum_form_string_array", must include one of >, $' - end - if @api_client.config.client_side_validation && opts[:'enum_form_string'] && !['_abc', '-efg', '(xyz)'].include?(opts[:'enum_form_string']) - fail ArgumentError, 'invalid value for "enum_form_string", must be one of _abc, -efg, (xyz)' - end - if @api_client.config.client_side_validation && opts[:'enum_header_string_array'] && !opts[:'enum_header_string_array'].all? { |item| ['>', '$'].include?(item) } - fail ArgumentError, 'invalid value for "enum_header_string_array", must include one of >, $' + if @api_client.config.client_side_validation && opts[:'enum_header_string_array'] && !['>', '$'].include?(opts[:'enum_header_string_array']) + fail ArgumentError, 'invalid value for "enum_header_string_array", must be one of >, $' end if @api_client.config.client_side_validation && opts[:'enum_header_string'] && !['_abc', '-efg', '(xyz)'].include?(opts[:'enum_header_string']) fail ArgumentError, 'invalid value for "enum_header_string", must be one of _abc, -efg, (xyz)' end - if @api_client.config.client_side_validation && opts[:'enum_query_string_array'] && !opts[:'enum_query_string_array'].all? { |item| ['>', '$'].include?(item) } - fail ArgumentError, 'invalid value for "enum_query_string_array", must include one of >, $' + if @api_client.config.client_side_validation && opts[:'enum_query_string_array'] && !['>', '$'].include?(opts[:'enum_query_string_array']) + fail ArgumentError, 'invalid value for "enum_query_string_array", must be one of >, $' end if @api_client.config.client_side_validation && opts[:'enum_query_string'] && !['_abc', '-efg', '(xyz)'].include?(opts[:'enum_query_string']) fail ArgumentError, 'invalid value for "enum_query_string", must be one of _abc, -efg, (xyz)' @@ -468,27 +424,23 @@ module Petstore # query parameters query_params = {} - query_params[:'enum_query_string_array'] = @api_client.build_collection_param(opts[:'enum_query_string_array'], :csv) if !opts[:'enum_query_string_array'].nil? + query_params[:'enum_query_string_array'] = opts[:'enum_query_string_array'] if !opts[:'enum_query_string_array'].nil? query_params[:'enum_query_string'] = opts[:'enum_query_string'] if !opts[:'enum_query_string'].nil? query_params[:'enum_query_integer'] = opts[:'enum_query_integer'] if !opts[:'enum_query_integer'].nil? + query_params[:'enum_query_double'] = opts[:'enum_query_double'] if !opts[:'enum_query_double'].nil? # header parameters header_params = {} - # 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(['*/*']) - 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_array'] = opts[:'enum_header_string_array'] if !opts[:'enum_header_string_array'].nil? header_params[:'enum_header_string'] = opts[:'enum_header_string'] if !opts[:'enum_header_string'].nil? # form parameters form_params = {} - form_params['enum_form_string_array'] = @api_client.build_collection_param(opts[:'enum_form_string_array'], :csv) if !opts[:'enum_form_string_array'].nil? - form_params['enum_form_string'] = opts[:'enum_form_string'] if !opts[:'enum_form_string'].nil? - form_params['enum_query_double'] = opts[:'enum_query_double'] if !opts[:'enum_query_double'].nil? # http body (model) - post_body = nil + post_body = @api_client.object_to_http_body(opts[:'UNKNOWN_PARAM_NAME']) auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, @@ -502,27 +454,25 @@ module Petstore return data, status_code, headers end # test inline additionalProperties - # - # @param param request body + # @param UNKNOWN_PARAM_NAME request body # @param [Hash] opts the optional parameters # @return [nil] - def test_inline_additional_properties(param, opts = {}) - test_inline_additional_properties_with_http_info(param, opts) + def test_inline_additional_properties(UNKNOWN_PARAM_NAME, opts = {}) + test_inline_additional_properties_with_http_info(UNKNOWN_PARAM_NAME, opts) nil end # test inline additionalProperties - # - # @param param request body + # @param UNKNOWN_PARAM_NAME request body # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers - def test_inline_additional_properties_with_http_info(param, opts = {}) + def test_inline_additional_properties_with_http_info(UNKNOWN_PARAM_NAME, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FakeApi.test_inline_additional_properties ...' end - # verify the required parameter 'param' is set - if @api_client.config.client_side_validation && param.nil? - fail ArgumentError, "Missing the required parameter 'param' when calling FakeApi.test_inline_additional_properties" + # verify the required parameter 'UNKNOWN_PARAM_NAME' is set + if @api_client.config.client_side_validation && UNKNOWN_PARAM_NAME.nil? + fail ArgumentError, "Missing the required parameter 'UNKNOWN_PARAM_NAME' when calling FakeApi.test_inline_additional_properties" end # resource path local_var_path = '/fake/inline-additionalProperties' @@ -539,7 +489,7 @@ module Petstore form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(param) + post_body = @api_client.object_to_http_body(UNKNOWN_PARAM_NAME) auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, @@ -553,33 +503,25 @@ module Petstore return data, status_code, headers end # test json serialization of form data - # - # @param param field1 - # @param param2 field2 + # @param UNKNOWN_PARAM_NAME # @param [Hash] opts the optional parameters # @return [nil] - def test_json_form_data(param, param2, opts = {}) - test_json_form_data_with_http_info(param, param2, opts) + def test_json_form_data(UNKNOWN_PARAM_NAME, opts = {}) + test_json_form_data_with_http_info(UNKNOWN_PARAM_NAME, opts) nil end # test json serialization of form data - # - # @param param field1 - # @param param2 field2 + # @param UNKNOWN_PARAM_NAME # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers - def test_json_form_data_with_http_info(param, param2, opts = {}) + def test_json_form_data_with_http_info(UNKNOWN_PARAM_NAME, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FakeApi.test_json_form_data ...' end - # verify the required parameter 'param' is set - if @api_client.config.client_side_validation && param.nil? - fail ArgumentError, "Missing the required parameter 'param' when calling FakeApi.test_json_form_data" - end - # verify the required parameter 'param2' is set - if @api_client.config.client_side_validation && param2.nil? - fail ArgumentError, "Missing the required parameter 'param2' when calling FakeApi.test_json_form_data" + # verify the required parameter 'UNKNOWN_PARAM_NAME' is set + if @api_client.config.client_side_validation && UNKNOWN_PARAM_NAME.nil? + fail ArgumentError, "Missing the required parameter 'UNKNOWN_PARAM_NAME' when calling FakeApi.test_json_form_data" end # resource path local_var_path = '/fake/jsonFormData' @@ -594,11 +536,9 @@ module Petstore # form parameters form_params = {} - form_params['param'] = param - form_params['param2'] = param2 # http body (model) - post_body = nil + post_body = @api_client.object_to_http_body(UNKNOWN_PARAM_NAME) auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_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 a3df63096f..1e2542794f 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 @@ -21,26 +21,26 @@ module Petstore end # To test class name in snake case # To test class name in snake case - # @param body client model + # @param client client model # @param [Hash] opts the optional parameters # @return [Client] - def test_classname(body, opts = {}) - data, _status_code, _headers = test_classname_with_http_info(body, opts) + def test_classname(client, opts = {}) + data, _status_code, _headers = test_classname_with_http_info(client, opts) data end # To test class name in snake case # To test class name in snake case - # @param body client model + # @param client client model # @param [Hash] opts the optional parameters # @return [Array<(Client, Fixnum, Hash)>] Client data, response status code and response headers - def test_classname_with_http_info(body, opts = {}) + def test_classname_with_http_info(client, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FakeClassnameTags123Api.test_classname ...' end - # verify the required parameter 'body' is set - if @api_client.config.client_side_validation && body.nil? - fail ArgumentError, "Missing the required parameter 'body' when calling FakeClassnameTags123Api.test_classname" + # verify the required parameter 'client' is set + if @api_client.config.client_side_validation && client.nil? + fail ArgumentError, "Missing the required parameter 'client' when calling FakeClassnameTags123Api.test_classname" end # resource path local_var_path = '/fake_classname_test' @@ -59,7 +59,7 @@ module Petstore form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(body) + post_body = @api_client.object_to_http_body(client) auth_names = ['api_key_query'] data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, :header_params => header_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 b5dc877eae..204235e155 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb @@ -20,27 +20,25 @@ module Petstore @api_client = api_client end # Add a new pet to the store - # - # @param body Pet object that needs to be added to the store + # @param pet Pet object that needs to be added to the store # @param [Hash] opts the optional parameters # @return [nil] - def add_pet(body, opts = {}) - add_pet_with_http_info(body, opts) + def add_pet(pet, opts = {}) + add_pet_with_http_info(pet, opts) nil end # Add a new pet to the store - # - # @param body Pet object that needs to be added to the store + # @param pet Pet object that needs to be added to the store # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers - def add_pet_with_http_info(body, opts = {}) + def add_pet_with_http_info(pet, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PetApi.add_pet ...' end - # verify the required parameter 'body' is set - if @api_client.config.client_side_validation && body.nil? - fail ArgumentError, "Missing the required parameter 'body' when calling PetApi.add_pet" + # verify the required parameter 'pet' is set + if @api_client.config.client_side_validation && pet.nil? + fail ArgumentError, "Missing the required parameter 'pet' when calling PetApi.add_pet" end # resource path local_var_path = '/pet' @@ -50,8 +48,6 @@ module Petstore # header parameters header_params = {} - # 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', 'application/xml']) @@ -59,7 +55,7 @@ module Petstore form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(body) + post_body = @api_client.object_to_http_body(pet) auth_names = ['petstore_auth'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, @@ -73,7 +69,6 @@ module Petstore return data, status_code, headers end # Deletes a pet - # # @param pet_id Pet id to delete # @param [Hash] opts the optional parameters # @option opts [String] :api_key @@ -84,7 +79,6 @@ module Petstore end # Deletes a pet - # # @param pet_id Pet id to delete # @param [Hash] opts the optional parameters # @option opts [String] :api_key @@ -105,8 +99,6 @@ module Petstore # header parameters header_params = {} - # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json']) header_params[:'api_key'] = opts[:'api_key'] if !opts[:'api_key'].nil? # form parameters @@ -154,7 +146,7 @@ module Petstore # query parameters query_params = {} - query_params[:'status'] = @api_client.build_collection_param(status, :csv) + query_params[:'status'] = status # header parameters header_params = {} @@ -207,7 +199,7 @@ module Petstore # query parameters query_params = {} - query_params[:'tags'] = @api_client.build_collection_param(tags, :csv) + query_params[:'tags'] = tags # header parameters header_params = {} @@ -285,27 +277,25 @@ module Petstore return data, status_code, headers end # Update an existing pet - # - # @param body Pet object that needs to be added to the store + # @param pet Pet object that needs to be added to the store # @param [Hash] opts the optional parameters # @return [nil] - def update_pet(body, opts = {}) - update_pet_with_http_info(body, opts) + def update_pet(pet, opts = {}) + update_pet_with_http_info(pet, opts) nil end # Update an existing pet - # - # @param body Pet object that needs to be added to the store + # @param pet Pet object that needs to be added to the store # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers - def update_pet_with_http_info(body, opts = {}) + def update_pet_with_http_info(pet, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PetApi.update_pet ...' end - # verify the required parameter 'body' is set - if @api_client.config.client_side_validation && body.nil? - fail ArgumentError, "Missing the required parameter 'body' when calling PetApi.update_pet" + # verify the required parameter 'pet' is set + if @api_client.config.client_side_validation && pet.nil? + fail ArgumentError, "Missing the required parameter 'pet' when calling PetApi.update_pet" end # resource path local_var_path = '/pet' @@ -315,8 +305,6 @@ module Petstore # header parameters header_params = {} - # 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', 'application/xml']) @@ -324,7 +312,7 @@ module Petstore form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(body) + post_body = @api_client.object_to_http_body(pet) auth_names = ['petstore_auth'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, @@ -338,7 +326,6 @@ module Petstore return data, status_code, headers end # Updates a pet in the store with form data - # # @param pet_id ID of pet that needs to be updated # @param [Hash] opts the optional parameters # @option opts [String] :name Updated name of the pet @@ -350,7 +337,6 @@ module Petstore end # Updates a pet in the store with form data - # # @param pet_id ID of pet that needs to be updated # @param [Hash] opts the optional parameters # @option opts [String] :name Updated name of the pet @@ -372,8 +358,6 @@ module Petstore # header parameters header_params = {} - # 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/x-www-form-urlencoded']) @@ -397,7 +381,6 @@ module Petstore return data, status_code, headers end # uploads an image - # # @param pet_id ID of pet to update # @param [Hash] opts the optional parameters # @option opts [String] :additional_metadata Additional data to pass to server @@ -409,7 +392,6 @@ module Petstore end # uploads an image - # # @param pet_id ID of pet to update # @param [Hash] opts the optional parameters # @option opts [String] :additional_metadata Additional data to pass to server 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 19de80a7a1..c77bb40eb2 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb @@ -50,8 +50,6 @@ module Petstore # header parameters header_params = {} - # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json']) # form parameters form_params = {} @@ -177,27 +175,25 @@ module Petstore return data, status_code, headers end # Place an order for a pet - # - # @param body order placed for purchasing the pet + # @param order order placed for purchasing the pet # @param [Hash] opts the optional parameters # @return [Order] - def place_order(body, opts = {}) - data, _status_code, _headers = place_order_with_http_info(body, opts) + def place_order(order, opts = {}) + data, _status_code, _headers = place_order_with_http_info(order, opts) data end # Place an order for a pet - # - # @param body order placed for purchasing the pet + # @param order order placed for purchasing the pet # @param [Hash] opts the optional parameters # @return [Array<(Order, Fixnum, Hash)>] Order data, response status code and response headers - def place_order_with_http_info(body, opts = {}) + def place_order_with_http_info(order, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: StoreApi.place_order ...' end - # verify the required parameter 'body' is set - if @api_client.config.client_side_validation && body.nil? - fail ArgumentError, "Missing the required parameter 'body' when calling StoreApi.place_order" + # verify the required parameter 'order' is set + if @api_client.config.client_side_validation && order.nil? + fail ArgumentError, "Missing the required parameter 'order' when calling StoreApi.place_order" end # resource path local_var_path = '/store/order' @@ -209,12 +205,14 @@ module Petstore header_params = {} # 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(['*/*']) # form parameters form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(body) + post_body = @api_client.object_to_http_body(order) auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_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 d1c9040cd3..514789865f 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/user_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/user_api.rb @@ -21,26 +21,26 @@ module Petstore end # Create user # This can only be done by the logged in user. - # @param body Created user object + # @param user Created user object # @param [Hash] opts the optional parameters # @return [nil] - def create_user(body, opts = {}) - create_user_with_http_info(body, opts) + def create_user(user, opts = {}) + create_user_with_http_info(user, opts) nil end # Create user # This can only be done by the logged in user. - # @param body Created user object + # @param user Created user object # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers - def create_user_with_http_info(body, opts = {}) + def create_user_with_http_info(user, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UserApi.create_user ...' end - # verify the required parameter 'body' is set - if @api_client.config.client_side_validation && body.nil? - fail ArgumentError, "Missing the required parameter 'body' when calling UserApi.create_user" + # verify the required parameter 'user' is set + if @api_client.config.client_side_validation && user.nil? + fail ArgumentError, "Missing the required parameter 'user' when calling UserApi.create_user" end # resource path local_var_path = '/user' @@ -50,14 +50,14 @@ module Petstore # header parameters header_params = {} - # 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(['*/*']) # form parameters form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(body) + post_body = @api_client.object_to_http_body(user) auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, @@ -71,27 +71,25 @@ module Petstore return data, status_code, headers end # Creates list of users with given input array - # - # @param body List of user object + # @param user List of user object # @param [Hash] opts the optional parameters # @return [nil] - def create_users_with_array_input(body, opts = {}) - create_users_with_array_input_with_http_info(body, opts) + def create_users_with_array_input(user, opts = {}) + create_users_with_array_input_with_http_info(user, opts) nil end # Creates list of users with given input array - # - # @param body List of user object + # @param user List of user object # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers - def create_users_with_array_input_with_http_info(body, opts = {}) + def create_users_with_array_input_with_http_info(user, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UserApi.create_users_with_array_input ...' end - # verify the required parameter 'body' is set - if @api_client.config.client_side_validation && body.nil? - fail ArgumentError, "Missing the required parameter 'body' when calling UserApi.create_users_with_array_input" + # verify the required parameter 'user' is set + if @api_client.config.client_side_validation && user.nil? + fail ArgumentError, "Missing the required parameter 'user' when calling UserApi.create_users_with_array_input" end # resource path local_var_path = '/user/createWithArray' @@ -101,14 +99,14 @@ module Petstore # header parameters header_params = {} - # 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(['*/*']) # form parameters form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(body) + post_body = @api_client.object_to_http_body(user) auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, @@ -122,27 +120,25 @@ module Petstore return data, status_code, headers end # Creates list of users with given input array - # - # @param body List of user object + # @param user List of user object # @param [Hash] opts the optional parameters # @return [nil] - def create_users_with_list_input(body, opts = {}) - create_users_with_list_input_with_http_info(body, opts) + def create_users_with_list_input(user, opts = {}) + create_users_with_list_input_with_http_info(user, opts) nil end # Creates list of users with given input array - # - # @param body List of user object + # @param user List of user object # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers - def create_users_with_list_input_with_http_info(body, opts = {}) + def create_users_with_list_input_with_http_info(user, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UserApi.create_users_with_list_input ...' end - # verify the required parameter 'body' is set - if @api_client.config.client_side_validation && body.nil? - fail ArgumentError, "Missing the required parameter 'body' when calling UserApi.create_users_with_list_input" + # verify the required parameter 'user' is set + if @api_client.config.client_side_validation && user.nil? + fail ArgumentError, "Missing the required parameter 'user' when calling UserApi.create_users_with_list_input" end # resource path local_var_path = '/user/createWithList' @@ -152,14 +148,14 @@ module Petstore # header parameters header_params = {} - # 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(['*/*']) # form parameters form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(body) + post_body = @api_client.object_to_http_body(user) auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, @@ -203,8 +199,6 @@ module Petstore # header parameters header_params = {} - # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json']) # form parameters form_params = {} @@ -224,7 +218,6 @@ module Petstore return data, status_code, headers end # Get user by user name - # # @param username The name that needs to be fetched. Use user1 for testing. # @param [Hash] opts the optional parameters # @return [User] @@ -234,7 +227,6 @@ module Petstore end # Get user by user name - # # @param username The name that needs to be fetched. Use user1 for testing. # @param [Hash] opts the optional parameters # @return [Array<(User, Fixnum, Hash)>] User data, response status code and response headers @@ -276,7 +268,6 @@ module Petstore return data, status_code, headers end # Logs user into the system - # # @param username The user name for login # @param password The password for login in clear text # @param [Hash] opts the optional parameters @@ -287,7 +278,6 @@ module Petstore end # Logs user into the system - # # @param username The user name for login # @param password The password for login in clear text # @param [Hash] opts the optional parameters @@ -336,7 +326,6 @@ module Petstore return data, status_code, headers end # Logs out current logged in user session - # # @param [Hash] opts the optional parameters # @return [nil] def logout_user(opts = {}) @@ -345,7 +334,6 @@ module Petstore end # Logs out current logged in user session - # # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def logout_user_with_http_info(opts = {}) @@ -360,8 +348,6 @@ module Petstore # header parameters header_params = {} - # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json']) # form parameters form_params = {} @@ -383,21 +369,21 @@ module Petstore # Updated user # This can only be done by the logged in user. # @param username name that need to be deleted - # @param body Updated user object + # @param user Updated user object # @param [Hash] opts the optional parameters # @return [nil] - def update_user(username, body, opts = {}) - update_user_with_http_info(username, body, opts) + def update_user(username, user, opts = {}) + update_user_with_http_info(username, user, opts) nil end # Updated user # This can only be done by the logged in user. # @param username name that need to be deleted - # @param body Updated user object + # @param user Updated user object # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers - def update_user_with_http_info(username, body, opts = {}) + def update_user_with_http_info(username, user, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UserApi.update_user ...' end @@ -405,9 +391,9 @@ module Petstore if @api_client.config.client_side_validation && username.nil? fail ArgumentError, "Missing the required parameter 'username' when calling UserApi.update_user" end - # verify the required parameter 'body' is set - if @api_client.config.client_side_validation && body.nil? - fail ArgumentError, "Missing the required parameter 'body' when calling UserApi.update_user" + # verify the required parameter 'user' is set + if @api_client.config.client_side_validation && user.nil? + fail ArgumentError, "Missing the required parameter 'user' when calling UserApi.update_user" end # resource path local_var_path = '/user/{username}'.sub('{' + 'username' + '}', username.to_s) @@ -417,14 +403,14 @@ module Petstore # header parameters header_params = {} - # 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(['*/*']) # form parameters form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(body) + post_body = @api_client.object_to_http_body(user) auth_names = [] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, diff --git a/samples/client/petstore/ruby/lib/petstore/configuration.rb b/samples/client/petstore/ruby/lib/petstore/configuration.rb index cda8832f73..7abc60e43e 100644 --- a/samples/client/petstore/ruby/lib/petstore/configuration.rb +++ b/samples/client/petstore/ruby/lib/petstore/configuration.rb @@ -129,7 +129,7 @@ module Petstore def initialize @scheme = 'http' - @host = 'petstore.swagger.io:80' + @host = 'petstore.swagger.io' @base_path = '/v2' @api_key = {} @api_key_prefix = {} diff --git a/samples/client/petstore/ruby/lib/petstore/models/array_of_array_of_number_only.rb b/samples/client/petstore/ruby/lib/petstore/models/array_of_array_of_number_only.rb index df47cecca8..bfb5d39c5c 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/array_of_array_of_number_only.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/array_of_array_of_number_only.rb @@ -26,7 +26,7 @@ module Petstore # Attribute type mapping. def self.swagger_types { - :'array_array_number' => :'Array>' + :'array_array_number' => :'Array>' } end diff --git a/samples/client/petstore/ruby/lib/petstore/models/array_of_number_only.rb b/samples/client/petstore/ruby/lib/petstore/models/array_of_number_only.rb index e4f51d61bc..1cb80da7e5 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/array_of_number_only.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/array_of_number_only.rb @@ -26,7 +26,7 @@ module Petstore # Attribute type mapping. def self.swagger_types { - :'array_number' => :'Array' + :'array_number' => :'Array' } end diff --git a/samples/client/petstore/ruby/lib/petstore/models/format_test.rb b/samples/client/petstore/ruby/lib/petstore/models/format_test.rb index b24d8e32a7..6933ae5f74 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/format_test.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/format_test.rb @@ -65,7 +65,7 @@ module Petstore :'integer' => :'Integer', :'int32' => :'Integer', :'int64' => :'Integer', - :'number' => :'Float', + :'number' => :'BigDecimal', :'float' => :'Float', :'double' => :'Float', :'string' => :'String', @@ -163,30 +163,6 @@ module Petstore invalid_properties.push('invalid value for "number", number cannot be nil.') end - if @number > 543.2 - invalid_properties.push('invalid value for "number", must be smaller than or equal to 543.2.') - end - - if @number < 32.1 - invalid_properties.push('invalid value for "number", must be greater than or equal to 32.1.') - end - - if !@float.nil? && @float > 987.6 - invalid_properties.push('invalid value for "float", must be smaller than or equal to 987.6.') - end - - if !@float.nil? && @float < 54.3 - invalid_properties.push('invalid value for "float", must be greater than or equal to 54.3.') - end - - if !@double.nil? && @double > 123.4 - invalid_properties.push('invalid value for "double", must be smaller than or equal to 123.4.') - end - - if !@double.nil? && @double < 67.8 - invalid_properties.push('invalid value for "double", must be greater than or equal to 67.8.') - end - if !@string.nil? && @string !~ Regexp.new(/[a-z]/i) invalid_properties.push('invalid value for "string", must conform to the pattern /[a-z]/i.') end @@ -226,12 +202,6 @@ module Petstore return false if !@int32.nil? && @int32 > 200 return false if !@int32.nil? && @int32 < 20 return false if @number.nil? - return false if @number > 543.2 - return false if @number < 32.1 - return false if !@float.nil? && @float > 987.6 - return false if !@float.nil? && @float < 54.3 - return false if !@double.nil? && @double > 123.4 - return false if !@double.nil? && @double < 67.8 return false if !@string.nil? && @string !~ Regexp.new(/[a-z]/i) return false if @byte.nil? return false if @byte !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/) @@ -270,52 +240,6 @@ module Petstore @int32 = int32 end - # Custom attribute writer method with validation - # @param [Object] number Value to be assigned - def number=(number) - if number.nil? - fail ArgumentError, 'number cannot be nil' - end - - if number > 543.2 - fail ArgumentError, 'invalid value for "number", must be smaller than or equal to 543.2.' - end - - if number < 32.1 - fail ArgumentError, 'invalid value for "number", must be greater than or equal to 32.1.' - end - - @number = number - end - - # Custom attribute writer method with validation - # @param [Object] float Value to be assigned - def float=(float) - if !float.nil? && float > 987.6 - fail ArgumentError, 'invalid value for "float", must be smaller than or equal to 987.6.' - end - - if !float.nil? && float < 54.3 - fail ArgumentError, 'invalid value for "float", must be greater than or equal to 54.3.' - end - - @float = float - end - - # Custom attribute writer method with validation - # @param [Object] double Value to be assigned - def double=(double) - if !double.nil? && double > 123.4 - fail ArgumentError, 'invalid value for "double", must be smaller than or equal to 123.4.' - end - - if !double.nil? && double < 67.8 - fail ArgumentError, 'invalid value for "double", must be greater than or equal to 67.8.' - end - - @double = double - end - # Custom attribute writer method with validation # @param [Object] string Value to be assigned def string=(string) diff --git a/samples/client/petstore/ruby/lib/petstore/models/number_only.rb b/samples/client/petstore/ruby/lib/petstore/models/number_only.rb index b84989631b..a55ffa9213 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/number_only.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/number_only.rb @@ -26,7 +26,7 @@ module Petstore # Attribute type mapping. def self.swagger_types { - :'just_number' => :'Float' + :'just_number' => :'BigDecimal' } end