From e5437e06a30ab8a14073f23b1072cd08b4222493 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Sun, 21 Sep 2025 23:33:40 +0800 Subject: [PATCH] Update Ruby faraday to use ruby fake petstore test spec (#22008) * update ruby faraday to use ruby fake petstore test spec * clean up, regenerate samples * update test --- bin/configs/ruby-faraday.yaml | 2 +- .../resources/ruby-client/model_test.mustache | 2 +- .../ruby-faraday/.openapi-generator/FILES | 20 +- .../client/petstore/ruby-faraday/README.md | 12 +- .../client/petstore/ruby-faraday/docs/Cow.md | 15 ++ .../petstore/ruby-faraday/docs/FakeApi.md | 132 +++++++------ .../petstore/ruby-faraday/docs/Mammal.md | 63 ++++++ .../petstore/ruby-faraday/docs/MammalAnyof.md | 24 +++ .../docs/MammalWithoutDiscriminator.md | 49 +++++ .../ruby-faraday/docs/OneOfPrimitiveTypes.md | 69 +++++++ .../ruby-faraday/docs/PropertyNameMapping.md | 24 +++ .../petstore/ruby-faraday/docs/Whale.md | 22 +++ .../petstore/ruby-faraday/docs/Zebra.md | 20 ++ .../petstore/ruby-faraday/lib/petstore.rb | 10 +- .../ruby-faraday/lib/petstore/api/fake_api.rb | 147 +++++++------- .../lib/petstore/configuration.rb | 183 ++++++++++++++++++ .../ruby-faraday/lib/petstore/models/cow.rb | 40 ++++ .../lib/petstore/models/mammal.rb | 43 ++++ .../lib/petstore/models/mammal_anyof.rb | 103 ++++++++++ .../models/mammal_without_discriminator.rb | 104 ++++++++++ .../petstore/models/one_of_primitive_types.rb | 114 +++++++++++ ...h_nullable.rb => property_name_mapping.rb} | 84 ++++---- .../{inline_response_default.rb => whale.rb} | 98 +++++++--- .../{parent_with_nullable.rb => zebra.rb} | 47 +++-- .../spec/custom/configuration_spec.rb | 2 +- .../additional_properties_class_spec.rb | 4 +- .../models/all_of_with_single_ref_spec.rb | 4 +- .../ruby-faraday/spec/models/animal_spec.rb | 4 +- .../spec/models/api_response_spec.rb | 4 +- .../array_of_array_of_number_only_spec.rb | 4 +- .../spec/models/array_of_number_only_spec.rb | 4 +- .../spec/models/array_test_spec.rb | 4 +- .../spec/models/capitalization_spec.rb | 4 +- .../ruby-faraday/spec/models/cat_spec.rb | 4 +- .../ruby-faraday/spec/models/category_spec.rb | 4 +- .../spec/models/class_model_spec.rb | 4 +- .../ruby-faraday/spec/models/client_spec.rb | 4 +- .../ruby-faraday/spec/models/cow_spec.rb | 30 +++ .../spec/models/deprecated_object_spec.rb | 4 +- .../ruby-faraday/spec/models/dog_spec.rb | 4 +- .../spec/models/enum_arrays_spec.rb | 4 +- .../spec/models/enum_class_spec.rb | 4 +- .../spec/models/enum_test_spec.rb | 4 +- .../fake_big_decimal_map200_response_spec.rb | 4 +- .../models/file_schema_test_class_spec.rb | 4 +- .../ruby-faraday/spec/models/file_spec.rb | 4 +- .../models/foo_get_default_response_spec.rb | 4 +- .../ruby-faraday/spec/models/foo_spec.rb | 4 +- .../spec/models/format_test_spec.rb | 4 +- .../spec/models/has_only_read_only_spec.rb | 4 +- .../spec/models/health_check_result_spec.rb | 4 +- .../ruby-faraday/spec/models/list_spec.rb | 4 +- .../spec/models/mammal_anyof_spec.rb | 21 ++ .../ruby-faraday/spec/models/mammal_spec.rb | 38 ++++ ...b => mammal_without_discriminator_spec.rb} | 20 +- .../ruby-faraday/spec/models/map_test_spec.rb | 4 +- ...es_and_additional_properties_class_spec.rb | 4 +- .../spec/models/model200_response_spec.rb | 4 +- .../spec/models/model_return_spec.rb | 4 +- .../ruby-faraday/spec/models/name_spec.rb | 4 +- .../spec/models/nullable_class_spec.rb | 4 +- .../spec/models/number_only_spec.rb | 4 +- .../object_with_deprecated_fields_spec.rb | 4 +- .../models/one_of_primitive_types_spec.rb | 32 +++ .../ruby-faraday/spec/models/order_spec.rb | 4 +- .../spec/models/outer_composite_spec.rb | 4 +- .../models/outer_enum_default_value_spec.rb | 4 +- .../outer_enum_integer_default_value_spec.rb | 4 +- .../spec/models/outer_enum_integer_spec.rb | 4 +- .../spec/models/outer_enum_spec.rb | 4 +- .../outer_object_with_enum_property_spec.rb | 4 +- .../ruby-faraday/spec/models/pet_spec.rb | 4 +- .../spec/models/property_name_mapping_spec.rb | 54 ++++++ .../spec/models/read_only_first_spec.rb | 4 +- .../spec/models/single_ref_type_spec.rb | 4 +- .../spec/models/special_model_name_spec.rb | 4 +- .../ruby-faraday/spec/models/tag_spec.rb | 4 +- ...form_additional_properties_request_spec.rb | 4 +- .../ruby-faraday/spec/models/user_spec.rb | 4 +- .../ruby-faraday/spec/models/whale_spec.rb | 48 +++++ ...nt_with_nullable_spec.rb => zebra_spec.rb} | 18 +- 81 files changed, 1529 insertions(+), 353 deletions(-) create mode 100644 samples/client/petstore/ruby-faraday/docs/Cow.md create mode 100644 samples/client/petstore/ruby-faraday/docs/Mammal.md create mode 100644 samples/client/petstore/ruby-faraday/docs/MammalAnyof.md create mode 100644 samples/client/petstore/ruby-faraday/docs/MammalWithoutDiscriminator.md create mode 100644 samples/client/petstore/ruby-faraday/docs/OneOfPrimitiveTypes.md create mode 100644 samples/client/petstore/ruby-faraday/docs/PropertyNameMapping.md create mode 100644 samples/client/petstore/ruby-faraday/docs/Whale.md create mode 100644 samples/client/petstore/ruby-faraday/docs/Zebra.md create mode 100644 samples/client/petstore/ruby-faraday/lib/petstore/models/cow.rb create mode 100644 samples/client/petstore/ruby-faraday/lib/petstore/models/mammal.rb create mode 100644 samples/client/petstore/ruby-faraday/lib/petstore/models/mammal_anyof.rb create mode 100644 samples/client/petstore/ruby-faraday/lib/petstore/models/mammal_without_discriminator.rb create mode 100644 samples/client/petstore/ruby-faraday/lib/petstore/models/one_of_primitive_types.rb rename samples/client/petstore/ruby-faraday/lib/petstore/models/{child_with_nullable.rb => property_name_mapping.rb} (79%) rename samples/client/petstore/ruby-faraday/lib/petstore/models/{inline_response_default.rb => whale.rb} (66%) rename samples/client/petstore/ruby-faraday/lib/petstore/models/{parent_with_nullable.rb => zebra.rb} (87%) create mode 100644 samples/client/petstore/ruby-faraday/spec/models/cow_spec.rb create mode 100644 samples/client/petstore/ruby-faraday/spec/models/mammal_anyof_spec.rb create mode 100644 samples/client/petstore/ruby-faraday/spec/models/mammal_spec.rb rename samples/client/petstore/ruby-faraday/spec/models/{child_with_nullable_spec.rb => mammal_without_discriminator_spec.rb} (54%) create mode 100644 samples/client/petstore/ruby-faraday/spec/models/one_of_primitive_types_spec.rb create mode 100644 samples/client/petstore/ruby-faraday/spec/models/property_name_mapping_spec.rb create mode 100644 samples/client/petstore/ruby-faraday/spec/models/whale_spec.rb rename samples/client/petstore/ruby-faraday/spec/models/{parent_with_nullable_spec.rb => zebra_spec.rb} (69%) diff --git a/bin/configs/ruby-faraday.yaml b/bin/configs/ruby-faraday.yaml index b289ae977f4..7e7731d6146 100644 --- a/bin/configs/ruby-faraday.yaml +++ b/bin/configs/ruby-faraday.yaml @@ -1,7 +1,7 @@ generatorName: ruby outputDir: samples/client/petstore/ruby-faraday library: faraday -inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml +inputSpec: modules/openapi-generator/src/test/resources/3_0/ruby/petstore-with-fake-endpoints-models-for-testing.yaml templateDir: modules/openapi-generator/src/main/resources/ruby-client additionalProperties: gemVersion: 1.0.0 diff --git a/modules/openapi-generator/src/main/resources/ruby-client/model_test.mustache b/modules/openapi-generator/src/main/resources/ruby-client/model_test.mustache index 9db4abcb499..468dff37895 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/model_test.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/model_test.mustache @@ -15,7 +15,7 @@ require 'date' describe {{moduleName}}::{{classname}} do {{^oneOf}} {{^anyOf}} - let(:instance) { {{moduleName}}::{{classname}}.new } + #let(:instance) { {{moduleName}}::{{classname}}.new } describe 'test an instance of {{classname}}' do it 'should create an instance of {{classname}}' do diff --git a/samples/client/petstore/ruby-faraday/.openapi-generator/FILES b/samples/client/petstore/ruby-faraday/.openapi-generator/FILES index 7dbd2fdcd84..fa488c13b2d 100644 --- a/samples/client/petstore/ruby-faraday/.openapi-generator/FILES +++ b/samples/client/petstore/ruby-faraday/.openapi-generator/FILES @@ -17,9 +17,9 @@ docs/ArrayTest.md docs/Capitalization.md docs/Cat.md docs/Category.md -docs/ChildWithNullable.md docs/ClassModel.md docs/Client.md +docs/Cow.md docs/DefaultApi.md docs/DeprecatedObject.md docs/Dog.md @@ -37,6 +37,9 @@ docs/FormatTest.md docs/HasOnlyReadOnly.md docs/HealthCheckResult.md docs/List.md +docs/Mammal.md +docs/MammalAnyof.md +docs/MammalWithoutDiscriminator.md docs/MapTest.md docs/MixedPropertiesAndAdditionalPropertiesClass.md docs/Model200Response.md @@ -45,6 +48,7 @@ docs/Name.md docs/NullableClass.md docs/NumberOnly.md docs/ObjectWithDeprecatedFields.md +docs/OneOfPrimitiveTypes.md docs/Order.md docs/OuterComposite.md docs/OuterEnum.md @@ -52,9 +56,9 @@ docs/OuterEnumDefaultValue.md docs/OuterEnumInteger.md docs/OuterEnumIntegerDefaultValue.md docs/OuterObjectWithEnumProperty.md -docs/ParentWithNullable.md docs/Pet.md docs/PetApi.md +docs/PropertyNameMapping.md docs/ReadOnlyFirst.md docs/SingleRefType.md docs/SpecialModelName.md @@ -63,6 +67,8 @@ docs/Tag.md docs/TestInlineFreeformAdditionalPropertiesRequest.md docs/User.md docs/UserApi.md +docs/Whale.md +docs/Zebra.md git_push.sh lib/petstore.rb lib/petstore/api/another_fake_api.rb @@ -85,9 +91,9 @@ lib/petstore/models/array_test.rb lib/petstore/models/capitalization.rb lib/petstore/models/cat.rb lib/petstore/models/category.rb -lib/petstore/models/child_with_nullable.rb lib/petstore/models/class_model.rb lib/petstore/models/client.rb +lib/petstore/models/cow.rb lib/petstore/models/deprecated_object.rb lib/petstore/models/dog.rb lib/petstore/models/enum_arrays.rb @@ -102,6 +108,9 @@ lib/petstore/models/format_test.rb lib/petstore/models/has_only_read_only.rb lib/petstore/models/health_check_result.rb lib/petstore/models/list.rb +lib/petstore/models/mammal.rb +lib/petstore/models/mammal_anyof.rb +lib/petstore/models/mammal_without_discriminator.rb lib/petstore/models/map_test.rb lib/petstore/models/mixed_properties_and_additional_properties_class.rb lib/petstore/models/model200_response.rb @@ -110,6 +119,7 @@ lib/petstore/models/name.rb lib/petstore/models/nullable_class.rb lib/petstore/models/number_only.rb lib/petstore/models/object_with_deprecated_fields.rb +lib/petstore/models/one_of_primitive_types.rb lib/petstore/models/order.rb lib/petstore/models/outer_composite.rb lib/petstore/models/outer_enum.rb @@ -117,14 +127,16 @@ lib/petstore/models/outer_enum_default_value.rb lib/petstore/models/outer_enum_integer.rb lib/petstore/models/outer_enum_integer_default_value.rb lib/petstore/models/outer_object_with_enum_property.rb -lib/petstore/models/parent_with_nullable.rb lib/petstore/models/pet.rb +lib/petstore/models/property_name_mapping.rb lib/petstore/models/read_only_first.rb lib/petstore/models/single_ref_type.rb lib/petstore/models/special_model_name.rb lib/petstore/models/tag.rb lib/petstore/models/test_inline_freeform_additional_properties_request.rb lib/petstore/models/user.rb +lib/petstore/models/whale.rb +lib/petstore/models/zebra.rb lib/petstore/version.rb petstore.gemspec spec/spec_helper.rb diff --git a/samples/client/petstore/ruby-faraday/README.md b/samples/client/petstore/ruby-faraday/README.md index 67ff24e8abb..587ccdfcb96 100644 --- a/samples/client/petstore/ruby-faraday/README.md +++ b/samples/client/petstore/ruby-faraday/README.md @@ -86,6 +86,7 @@ Class | Method | HTTP request | Description *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* | [**fake_property_enum_integer_serialize**](docs/FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | +*Petstore::FakeApi* | [**get_parameter_name_mapping**](docs/FakeApi.md#get_parameter_name_mapping) | **GET** /fake/parameter-name-mapping | parameter name mapping test *Petstore::FakeApi* | [**test_additional_properties_reference**](docs/FakeApi.md#test_additional_properties_reference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *Petstore::FakeApi* | [**test_body_with_binary**](docs/FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | *Petstore::FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | @@ -97,7 +98,6 @@ Class | Method | HTTP request | Description *Petstore::FakeApi* | [**test_inline_additional_properties**](docs/FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties *Petstore::FakeApi* | [**test_inline_freeform_additional_properties**](docs/FakeApi.md#test_inline_freeform_additional_properties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties *Petstore::FakeApi* | [**test_json_form_data**](docs/FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data -*Petstore::FakeApi* | [**test_nullable**](docs/FakeApi.md#test_nullable) | **POST** /fake/nullable | test nullable parent property *Petstore::FakeApi* | [**test_query_parameter_collection_format**](docs/FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-parameters | *Petstore::FakeApi* | [**test_string_map_reference**](docs/FakeApi.md#test_string_map_reference) | **POST** /fake/stringMap-reference | test referenced string map *Petstore::FakeClassnameTags123Api* | [**test_classname**](docs/FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case @@ -136,9 +136,9 @@ Class | Method | HTTP request | Description - [Petstore::Capitalization](docs/Capitalization.md) - [Petstore::Cat](docs/Cat.md) - [Petstore::Category](docs/Category.md) - - [Petstore::ChildWithNullable](docs/ChildWithNullable.md) - [Petstore::ClassModel](docs/ClassModel.md) - [Petstore::Client](docs/Client.md) + - [Petstore::Cow](docs/Cow.md) - [Petstore::DeprecatedObject](docs/DeprecatedObject.md) - [Petstore::Dog](docs/Dog.md) - [Petstore::EnumArrays](docs/EnumArrays.md) @@ -153,6 +153,9 @@ Class | Method | HTTP request | Description - [Petstore::HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [Petstore::HealthCheckResult](docs/HealthCheckResult.md) - [Petstore::List](docs/List.md) + - [Petstore::Mammal](docs/Mammal.md) + - [Petstore::MammalAnyof](docs/MammalAnyof.md) + - [Petstore::MammalWithoutDiscriminator](docs/MammalWithoutDiscriminator.md) - [Petstore::MapTest](docs/MapTest.md) - [Petstore::MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) - [Petstore::Model200Response](docs/Model200Response.md) @@ -161,6 +164,7 @@ Class | Method | HTTP request | Description - [Petstore::NullableClass](docs/NullableClass.md) - [Petstore::NumberOnly](docs/NumberOnly.md) - [Petstore::ObjectWithDeprecatedFields](docs/ObjectWithDeprecatedFields.md) + - [Petstore::OneOfPrimitiveTypes](docs/OneOfPrimitiveTypes.md) - [Petstore::Order](docs/Order.md) - [Petstore::OuterComposite](docs/OuterComposite.md) - [Petstore::OuterEnum](docs/OuterEnum.md) @@ -168,14 +172,16 @@ Class | Method | HTTP request | Description - [Petstore::OuterEnumInteger](docs/OuterEnumInteger.md) - [Petstore::OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md) - [Petstore::OuterObjectWithEnumProperty](docs/OuterObjectWithEnumProperty.md) - - [Petstore::ParentWithNullable](docs/ParentWithNullable.md) - [Petstore::Pet](docs/Pet.md) + - [Petstore::PropertyNameMapping](docs/PropertyNameMapping.md) - [Petstore::ReadOnlyFirst](docs/ReadOnlyFirst.md) - [Petstore::SingleRefType](docs/SingleRefType.md) - [Petstore::SpecialModelName](docs/SpecialModelName.md) - [Petstore::Tag](docs/Tag.md) - [Petstore::TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md) - [Petstore::User](docs/User.md) + - [Petstore::Whale](docs/Whale.md) + - [Petstore::Zebra](docs/Zebra.md) ## Documentation for Authorization diff --git a/samples/client/petstore/ruby-faraday/docs/Cow.md b/samples/client/petstore/ruby-faraday/docs/Cow.md new file mode 100644 index 00000000000..6fa7084b8a4 --- /dev/null +++ b/samples/client/petstore/ruby-faraday/docs/Cow.md @@ -0,0 +1,15 @@ +# Petstore::Cow + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'petstore' + +instance = Petstore::Cow.new() +``` + diff --git a/samples/client/petstore/ruby-faraday/docs/FakeApi.md b/samples/client/petstore/ruby-faraday/docs/FakeApi.md index 4262104d12a..1e05788c53a 100644 --- a/samples/client/petstore/ruby-faraday/docs/FakeApi.md +++ b/samples/client/petstore/ruby-faraday/docs/FakeApi.md @@ -12,6 +12,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**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 | | | [**fake_property_enum_integer_serialize**](FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | | +| [**get_parameter_name_mapping**](FakeApi.md#get_parameter_name_mapping) | **GET** /fake/parameter-name-mapping | parameter name mapping test | | [**test_additional_properties_reference**](FakeApi.md#test_additional_properties_reference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | | [**test_body_with_binary**](FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | | | [**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | | @@ -23,7 +24,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**test_inline_additional_properties**](FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties | | [**test_inline_freeform_additional_properties**](FakeApi.md#test_inline_freeform_additional_properties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties | | [**test_json_form_data**](FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data | -| [**test_nullable**](FakeApi.md#test_nullable) | **POST** /fake/nullable | test nullable parent property | | [**test_query_parameter_collection_format**](FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-parameters | | | [**test_string_map_reference**](FakeApi.md#test_string_map_reference) | **POST** /fake/stringMap-reference | test referenced string map | @@ -546,6 +546,73 @@ No authorization required - **Accept**: */* +## get_parameter_name_mapping + +> get_parameter_name_mapping(_type, type, type_, http_debug_option) + +parameter name mapping test + +### Examples + +```ruby +require 'time' +require 'petstore' + +api_instance = Petstore::FakeApi.new +_type = 789 # Integer | _type +type = 'type_example' # String | type +type_ = 'type__example' # String | type_ +http_debug_option = 'http_debug_option_example' # String | http debug option (to test parameter naming option) + +begin + # parameter name mapping test + api_instance.get_parameter_name_mapping(_type, type, type_, http_debug_option) +rescue Petstore::ApiError => e + puts "Error when calling FakeApi->get_parameter_name_mapping: #{e}" +end +``` + +#### Using the get_parameter_name_mapping_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> get_parameter_name_mapping_with_http_info(_type, type, type_, http_debug_option) + +```ruby +begin + # parameter name mapping test + data, status_code, headers = api_instance.get_parameter_name_mapping_with_http_info(_type, type, type_, http_debug_option) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue Petstore::ApiError => e + puts "Error when calling FakeApi->get_parameter_name_mapping_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **_type** | **Integer** | _type | | +| **type** | **String** | type | | +| **type_** | **String** | type_ | | +| **http_debug_option** | **String** | http debug option (to test parameter naming option) | | + +### Return type + +nil (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + ## test_additional_properties_reference > test_additional_properties_reference(request_body) @@ -1311,69 +1378,6 @@ No authorization required - **Accept**: Not defined -## test_nullable - -> test_nullable(child_with_nullable) - -test nullable parent property - - - -### Examples - -```ruby -require 'time' -require 'petstore' - -api_instance = Petstore::FakeApi.new -child_with_nullable = Petstore::ChildWithNullable.new # ChildWithNullable | request body - -begin - # test nullable parent property - api_instance.test_nullable(child_with_nullable) -rescue Petstore::ApiError => e - puts "Error when calling FakeApi->test_nullable: #{e}" -end -``` - -#### Using the test_nullable_with_http_info variant - -This returns an Array which contains the response data (`nil` in this case), status code and headers. - -> test_nullable_with_http_info(child_with_nullable) - -```ruby -begin - # test nullable parent property - data, status_code, headers = api_instance.test_nullable_with_http_info(child_with_nullable) - p status_code # => 2xx - p headers # => { ... } - p data # => nil -rescue Petstore::ApiError => e - puts "Error when calling FakeApi->test_nullable_with_http_info: #{e}" -end -``` - -### Parameters - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **child_with_nullable** | [**ChildWithNullable**](ChildWithNullable.md) | request body | | - -### Return type - -nil (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: application/json -- **Accept**: Not defined - - ## test_query_parameter_collection_format > test_query_parameter_collection_format(pipe, ioutil, http, url, context, allow_empty, opts) diff --git a/samples/client/petstore/ruby-faraday/docs/Mammal.md b/samples/client/petstore/ruby-faraday/docs/Mammal.md new file mode 100644 index 00000000000..399834f63d3 --- /dev/null +++ b/samples/client/petstore/ruby-faraday/docs/Mammal.md @@ -0,0 +1,63 @@ +# Petstore::Mammal + +## Class instance methods + +### `openapi_one_of` + +Returns the list of classes defined in oneOf. + +#### Example + +```ruby +require 'petstore' + +Petstore::Mammal.openapi_one_of +# => +# [ +# :'Whale', +# :'Zebra' +# ] +``` + +### `openapi_discriminator_name` + +Returns the discriminator's property name. + +#### Example + +```ruby +require 'petstore' + +Petstore::Mammal.openapi_discriminator_name +# => :'classname' +``` +``` + +### build + +Find the appropriate object from the `openapi_one_of` list and casts the data into it. + +#### Example + +```ruby +require 'petstore' + +Petstore::Mammal.build(data) +# => # + +Petstore::Mammal.build(data_that_doesnt_match) +# => nil +``` + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| **data** | **Mixed** | data to be matched against the list of oneOf items | + +#### Return type + +- `Whale` +- `Zebra` +- `nil` (if no type matches) + diff --git a/samples/client/petstore/ruby-faraday/docs/MammalAnyof.md b/samples/client/petstore/ruby-faraday/docs/MammalAnyof.md new file mode 100644 index 00000000000..bd21a482f1a --- /dev/null +++ b/samples/client/petstore/ruby-faraday/docs/MammalAnyof.md @@ -0,0 +1,24 @@ +# Petstore::MammalAnyof + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **has_baleen** | **Boolean** | | [optional] | +| **has_teeth** | **Boolean** | | [optional] | +| **classname** | **String** | | | +| **type** | **String** | | [optional] | + +## Example + +```ruby +require 'petstore' + +instance = Petstore::MammalAnyof.new( + has_baleen: null, + has_teeth: null, + classname: null, + type: null +) +``` + diff --git a/samples/client/petstore/ruby-faraday/docs/MammalWithoutDiscriminator.md b/samples/client/petstore/ruby-faraday/docs/MammalWithoutDiscriminator.md new file mode 100644 index 00000000000..d6849503044 --- /dev/null +++ b/samples/client/petstore/ruby-faraday/docs/MammalWithoutDiscriminator.md @@ -0,0 +1,49 @@ +# Petstore::MammalWithoutDiscriminator + +## Class instance methods + +### `openapi_one_of` + +Returns the list of classes defined in oneOf. + +#### Example + +```ruby +require 'petstore' + +Petstore::MammalWithoutDiscriminator.openapi_one_of +# => +# [ +# :'Whale', +# :'Zebra' +# ] +``` + +### build + +Find the appropriate object from the `openapi_one_of` list and casts the data into it. + +#### Example + +```ruby +require 'petstore' + +Petstore::MammalWithoutDiscriminator.build(data) +# => # + +Petstore::MammalWithoutDiscriminator.build(data_that_doesnt_match) +# => nil +``` + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| **data** | **Mixed** | data to be matched against the list of oneOf items | + +#### Return type + +- `Whale` +- `Zebra` +- `nil` (if no type matches) + diff --git a/samples/client/petstore/ruby-faraday/docs/OneOfPrimitiveTypes.md b/samples/client/petstore/ruby-faraday/docs/OneOfPrimitiveTypes.md new file mode 100644 index 00000000000..9023811f8f1 --- /dev/null +++ b/samples/client/petstore/ruby-faraday/docs/OneOfPrimitiveTypes.md @@ -0,0 +1,69 @@ +# Petstore::OneOfPrimitiveTypes + +## Class instance methods + +### `openapi_one_of` + +Returns the list of classes defined in oneOf. + +#### Example + +```ruby +require 'petstore' + +Petstore::OneOfPrimitiveTypes.openapi_one_of +# => +# [ +# :'Array', +# :'Array', +# :'Array', +# :'Array', +# :'Array', +# :'Array