Skip to content

Commit e5437e0

Browse files
authored
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
1 parent 7e9b961 commit e5437e0

File tree

81 files changed

+1531
-355
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+1531
-355
lines changed

bin/configs/ruby-faraday.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
generatorName: ruby
22
outputDir: samples/client/petstore/ruby-faraday
33
library: faraday
4-
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
4+
inputSpec: modules/openapi-generator/src/test/resources/3_0/ruby/petstore-with-fake-endpoints-models-for-testing.yaml
55
templateDir: modules/openapi-generator/src/main/resources/ruby-client
66
additionalProperties:
77
gemVersion: 1.0.0

modules/openapi-generator/src/main/resources/ruby-client/model_test.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ require 'date'
1515
describe {{moduleName}}::{{classname}} do
1616
{{^oneOf}}
1717
{{^anyOf}}
18-
let(:instance) { {{moduleName}}::{{classname}}.new }
18+
#let(:instance) { {{moduleName}}::{{classname}}.new }
1919

2020
describe 'test an instance of {{classname}}' do
2121
it 'should create an instance of {{classname}}' do

samples/client/petstore/ruby-faraday/.openapi-generator/FILES

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ docs/ArrayTest.md
1717
docs/Capitalization.md
1818
docs/Cat.md
1919
docs/Category.md
20-
docs/ChildWithNullable.md
2120
docs/ClassModel.md
2221
docs/Client.md
22+
docs/Cow.md
2323
docs/DefaultApi.md
2424
docs/DeprecatedObject.md
2525
docs/Dog.md
@@ -37,6 +37,9 @@ docs/FormatTest.md
3737
docs/HasOnlyReadOnly.md
3838
docs/HealthCheckResult.md
3939
docs/List.md
40+
docs/Mammal.md
41+
docs/MammalAnyof.md
42+
docs/MammalWithoutDiscriminator.md
4043
docs/MapTest.md
4144
docs/MixedPropertiesAndAdditionalPropertiesClass.md
4245
docs/Model200Response.md
@@ -45,16 +48,17 @@ docs/Name.md
4548
docs/NullableClass.md
4649
docs/NumberOnly.md
4750
docs/ObjectWithDeprecatedFields.md
51+
docs/OneOfPrimitiveTypes.md
4852
docs/Order.md
4953
docs/OuterComposite.md
5054
docs/OuterEnum.md
5155
docs/OuterEnumDefaultValue.md
5256
docs/OuterEnumInteger.md
5357
docs/OuterEnumIntegerDefaultValue.md
5458
docs/OuterObjectWithEnumProperty.md
55-
docs/ParentWithNullable.md
5659
docs/Pet.md
5760
docs/PetApi.md
61+
docs/PropertyNameMapping.md
5862
docs/ReadOnlyFirst.md
5963
docs/SingleRefType.md
6064
docs/SpecialModelName.md
@@ -63,6 +67,8 @@ docs/Tag.md
6367
docs/TestInlineFreeformAdditionalPropertiesRequest.md
6468
docs/User.md
6569
docs/UserApi.md
70+
docs/Whale.md
71+
docs/Zebra.md
6672
git_push.sh
6773
lib/petstore.rb
6874
lib/petstore/api/another_fake_api.rb
@@ -85,9 +91,9 @@ lib/petstore/models/array_test.rb
8591
lib/petstore/models/capitalization.rb
8692
lib/petstore/models/cat.rb
8793
lib/petstore/models/category.rb
88-
lib/petstore/models/child_with_nullable.rb
8994
lib/petstore/models/class_model.rb
9095
lib/petstore/models/client.rb
96+
lib/petstore/models/cow.rb
9197
lib/petstore/models/deprecated_object.rb
9298
lib/petstore/models/dog.rb
9399
lib/petstore/models/enum_arrays.rb
@@ -102,6 +108,9 @@ lib/petstore/models/format_test.rb
102108
lib/petstore/models/has_only_read_only.rb
103109
lib/petstore/models/health_check_result.rb
104110
lib/petstore/models/list.rb
111+
lib/petstore/models/mammal.rb
112+
lib/petstore/models/mammal_anyof.rb
113+
lib/petstore/models/mammal_without_discriminator.rb
105114
lib/petstore/models/map_test.rb
106115
lib/petstore/models/mixed_properties_and_additional_properties_class.rb
107116
lib/petstore/models/model200_response.rb
@@ -110,21 +119,24 @@ lib/petstore/models/name.rb
110119
lib/petstore/models/nullable_class.rb
111120
lib/petstore/models/number_only.rb
112121
lib/petstore/models/object_with_deprecated_fields.rb
122+
lib/petstore/models/one_of_primitive_types.rb
113123
lib/petstore/models/order.rb
114124
lib/petstore/models/outer_composite.rb
115125
lib/petstore/models/outer_enum.rb
116126
lib/petstore/models/outer_enum_default_value.rb
117127
lib/petstore/models/outer_enum_integer.rb
118128
lib/petstore/models/outer_enum_integer_default_value.rb
119129
lib/petstore/models/outer_object_with_enum_property.rb
120-
lib/petstore/models/parent_with_nullable.rb
121130
lib/petstore/models/pet.rb
131+
lib/petstore/models/property_name_mapping.rb
122132
lib/petstore/models/read_only_first.rb
123133
lib/petstore/models/single_ref_type.rb
124134
lib/petstore/models/special_model_name.rb
125135
lib/petstore/models/tag.rb
126136
lib/petstore/models/test_inline_freeform_additional_properties_request.rb
127137
lib/petstore/models/user.rb
138+
lib/petstore/models/whale.rb
139+
lib/petstore/models/zebra.rb
128140
lib/petstore/version.rb
129141
petstore.gemspec
130142
spec/spec_helper.rb

samples/client/petstore/ruby-faraday/README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ Class | Method | HTTP request | Description
8686
*Petstore::FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number |
8787
*Petstore::FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string |
8888
*Petstore::FakeApi* | [**fake_property_enum_integer_serialize**](docs/FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int |
89+
*Petstore::FakeApi* | [**get_parameter_name_mapping**](docs/FakeApi.md#get_parameter_name_mapping) | **GET** /fake/parameter-name-mapping | parameter name mapping test
8990
*Petstore::FakeApi* | [**test_additional_properties_reference**](docs/FakeApi.md#test_additional_properties_reference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties
9091
*Petstore::FakeApi* | [**test_body_with_binary**](docs/FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary |
9192
*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
9798
*Petstore::FakeApi* | [**test_inline_additional_properties**](docs/FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties
9899
*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
99100
*Petstore::FakeApi* | [**test_json_form_data**](docs/FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data
100-
*Petstore::FakeApi* | [**test_nullable**](docs/FakeApi.md#test_nullable) | **POST** /fake/nullable | test nullable parent property
101101
*Petstore::FakeApi* | [**test_query_parameter_collection_format**](docs/FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-parameters |
102102
*Petstore::FakeApi* | [**test_string_map_reference**](docs/FakeApi.md#test_string_map_reference) | **POST** /fake/stringMap-reference | test referenced string map
103103
*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
136136
- [Petstore::Capitalization](docs/Capitalization.md)
137137
- [Petstore::Cat](docs/Cat.md)
138138
- [Petstore::Category](docs/Category.md)
139-
- [Petstore::ChildWithNullable](docs/ChildWithNullable.md)
140139
- [Petstore::ClassModel](docs/ClassModel.md)
141140
- [Petstore::Client](docs/Client.md)
141+
- [Petstore::Cow](docs/Cow.md)
142142
- [Petstore::DeprecatedObject](docs/DeprecatedObject.md)
143143
- [Petstore::Dog](docs/Dog.md)
144144
- [Petstore::EnumArrays](docs/EnumArrays.md)
@@ -153,6 +153,9 @@ Class | Method | HTTP request | Description
153153
- [Petstore::HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
154154
- [Petstore::HealthCheckResult](docs/HealthCheckResult.md)
155155
- [Petstore::List](docs/List.md)
156+
- [Petstore::Mammal](docs/Mammal.md)
157+
- [Petstore::MammalAnyof](docs/MammalAnyof.md)
158+
- [Petstore::MammalWithoutDiscriminator](docs/MammalWithoutDiscriminator.md)
156159
- [Petstore::MapTest](docs/MapTest.md)
157160
- [Petstore::MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
158161
- [Petstore::Model200Response](docs/Model200Response.md)
@@ -161,21 +164,24 @@ Class | Method | HTTP request | Description
161164
- [Petstore::NullableClass](docs/NullableClass.md)
162165
- [Petstore::NumberOnly](docs/NumberOnly.md)
163166
- [Petstore::ObjectWithDeprecatedFields](docs/ObjectWithDeprecatedFields.md)
167+
- [Petstore::OneOfPrimitiveTypes](docs/OneOfPrimitiveTypes.md)
164168
- [Petstore::Order](docs/Order.md)
165169
- [Petstore::OuterComposite](docs/OuterComposite.md)
166170
- [Petstore::OuterEnum](docs/OuterEnum.md)
167171
- [Petstore::OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md)
168172
- [Petstore::OuterEnumInteger](docs/OuterEnumInteger.md)
169173
- [Petstore::OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md)
170174
- [Petstore::OuterObjectWithEnumProperty](docs/OuterObjectWithEnumProperty.md)
171-
- [Petstore::ParentWithNullable](docs/ParentWithNullable.md)
172175
- [Petstore::Pet](docs/Pet.md)
176+
- [Petstore::PropertyNameMapping](docs/PropertyNameMapping.md)
173177
- [Petstore::ReadOnlyFirst](docs/ReadOnlyFirst.md)
174178
- [Petstore::SingleRefType](docs/SingleRefType.md)
175179
- [Petstore::SpecialModelName](docs/SpecialModelName.md)
176180
- [Petstore::Tag](docs/Tag.md)
177181
- [Petstore::TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md)
178182
- [Petstore::User](docs/User.md)
183+
- [Petstore::Whale](docs/Whale.md)
184+
- [Petstore::Zebra](docs/Zebra.md)
179185

180186

181187
## Documentation for Authorization
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Petstore::Cow
2+
3+
## Properties
4+
5+
| Name | Type | Description | Notes |
6+
| ---- | ---- | ----------- | ----- |
7+
8+
## Example
9+
10+
```ruby
11+
require 'petstore'
12+
13+
instance = Petstore::Cow.new()
14+
```
15+

samples/client/petstore/ruby-faraday/docs/FakeApi.md

Lines changed: 68 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
1212
| [**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | |
1313
| [**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | |
1414
| [**fake_property_enum_integer_serialize**](FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | |
15+
| [**get_parameter_name_mapping**](FakeApi.md#get_parameter_name_mapping) | **GET** /fake/parameter-name-mapping | parameter name mapping test |
1516
| [**test_additional_properties_reference**](FakeApi.md#test_additional_properties_reference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties |
1617
| [**test_body_with_binary**](FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | |
1718
| [**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*
2324
| [**test_inline_additional_properties**](FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties |
2425
| [**test_inline_freeform_additional_properties**](FakeApi.md#test_inline_freeform_additional_properties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties |
2526
| [**test_json_form_data**](FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data |
26-
| [**test_nullable**](FakeApi.md#test_nullable) | **POST** /fake/nullable | test nullable parent property |
2727
| [**test_query_parameter_collection_format**](FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-parameters | |
2828
| [**test_string_map_reference**](FakeApi.md#test_string_map_reference) | **POST** /fake/stringMap-reference | test referenced string map |
2929

@@ -546,6 +546,73 @@ No authorization required
546546
- **Accept**: */*
547547

548548

549+
## get_parameter_name_mapping
550+
551+
> get_parameter_name_mapping(_type, type, type_, http_debug_option)
552+
553+
parameter name mapping test
554+
555+
### Examples
556+
557+
```ruby
558+
require 'time'
559+
require 'petstore'
560+
561+
api_instance = Petstore::FakeApi.new
562+
_type = 789 # Integer | _type
563+
type = 'type_example' # String | type
564+
type_ = 'type__example' # String | type_
565+
http_debug_option = 'http_debug_option_example' # String | http debug option (to test parameter naming option)
566+
567+
begin
568+
# parameter name mapping test
569+
api_instance.get_parameter_name_mapping(_type, type, type_, http_debug_option)
570+
rescue Petstore::ApiError => e
571+
puts "Error when calling FakeApi->get_parameter_name_mapping: #{e}"
572+
end
573+
```
574+
575+
#### Using the get_parameter_name_mapping_with_http_info variant
576+
577+
This returns an Array which contains the response data (`nil` in this case), status code and headers.
578+
579+
> <Array(nil, Integer, Hash)> get_parameter_name_mapping_with_http_info(_type, type, type_, http_debug_option)
580+
581+
```ruby
582+
begin
583+
# parameter name mapping test
584+
data, status_code, headers = api_instance.get_parameter_name_mapping_with_http_info(_type, type, type_, http_debug_option)
585+
p status_code # => 2xx
586+
p headers # => { ... }
587+
p data # => nil
588+
rescue Petstore::ApiError => e
589+
puts "Error when calling FakeApi->get_parameter_name_mapping_with_http_info: #{e}"
590+
end
591+
```
592+
593+
### Parameters
594+
595+
| Name | Type | Description | Notes |
596+
| ---- | ---- | ----------- | ----- |
597+
| **_type** | **Integer** | _type | |
598+
| **type** | **String** | type | |
599+
| **type_** | **String** | type_ | |
600+
| **http_debug_option** | **String** | http debug option (to test parameter naming option) | |
601+
602+
### Return type
603+
604+
nil (empty response body)
605+
606+
### Authorization
607+
608+
No authorization required
609+
610+
### HTTP request headers
611+
612+
- **Content-Type**: Not defined
613+
- **Accept**: Not defined
614+
615+
549616
## test_additional_properties_reference
550617

551618
> test_additional_properties_reference(request_body)
@@ -1311,69 +1378,6 @@ No authorization required
13111378
- **Accept**: Not defined
13121379

13131380

1314-
## test_nullable
1315-
1316-
> test_nullable(child_with_nullable)
1317-
1318-
test nullable parent property
1319-
1320-
1321-
1322-
### Examples
1323-
1324-
```ruby
1325-
require 'time'
1326-
require 'petstore'
1327-
1328-
api_instance = Petstore::FakeApi.new
1329-
child_with_nullable = Petstore::ChildWithNullable.new # ChildWithNullable | request body
1330-
1331-
begin
1332-
# test nullable parent property
1333-
api_instance.test_nullable(child_with_nullable)
1334-
rescue Petstore::ApiError => e
1335-
puts "Error when calling FakeApi->test_nullable: #{e}"
1336-
end
1337-
```
1338-
1339-
#### Using the test_nullable_with_http_info variant
1340-
1341-
This returns an Array which contains the response data (`nil` in this case), status code and headers.
1342-
1343-
> <Array(nil, Integer, Hash)> test_nullable_with_http_info(child_with_nullable)
1344-
1345-
```ruby
1346-
begin
1347-
# test nullable parent property
1348-
data, status_code, headers = api_instance.test_nullable_with_http_info(child_with_nullable)
1349-
p status_code # => 2xx
1350-
p headers # => { ... }
1351-
p data # => nil
1352-
rescue Petstore::ApiError => e
1353-
puts "Error when calling FakeApi->test_nullable_with_http_info: #{e}"
1354-
end
1355-
```
1356-
1357-
### Parameters
1358-
1359-
| Name | Type | Description | Notes |
1360-
| ---- | ---- | ----------- | ----- |
1361-
| **child_with_nullable** | [**ChildWithNullable**](ChildWithNullable.md) | request body | |
1362-
1363-
### Return type
1364-
1365-
nil (empty response body)
1366-
1367-
### Authorization
1368-
1369-
No authorization required
1370-
1371-
### HTTP request headers
1372-
1373-
- **Content-Type**: application/json
1374-
- **Accept**: Not defined
1375-
1376-
13771381
## test_query_parameter_collection_format
13781382

13791383
> test_query_parameter_collection_format(pipe, ioutil, http, url, context, allow_empty, opts)

0 commit comments

Comments
 (0)