mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-10-13 16:03:43 +00:00
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
This commit is contained in:
parent
7e9b9615db
commit
e5437e06a3
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
15
samples/client/petstore/ruby-faraday/docs/Cow.md
Normal file
15
samples/client/petstore/ruby-faraday/docs/Cow.md
Normal file
@ -0,0 +1,15 @@
|
||||
# Petstore::Cow
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
| ---- | ---- | ----------- | ----- |
|
||||
|
||||
## Example
|
||||
|
||||
```ruby
|
||||
require 'petstore'
|
||||
|
||||
instance = Petstore::Cow.new()
|
||||
```
|
||||
|
@ -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.
|
||||
|
||||
> <Array(nil, Integer, Hash)> 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.
|
||||
|
||||
> <Array(nil, Integer, Hash)> 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)
|
||||
|
63
samples/client/petstore/ruby-faraday/docs/Mammal.md
Normal file
63
samples/client/petstore/ruby-faraday/docs/Mammal.md
Normal file
@ -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)
|
||||
# => #<Whale:0x00007fdd4aab02a0>
|
||||
|
||||
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)
|
||||
|
24
samples/client/petstore/ruby-faraday/docs/MammalAnyof.md
Normal file
24
samples/client/petstore/ruby-faraday/docs/MammalAnyof.md
Normal file
@ -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
|
||||
)
|
||||
```
|
||||
|
@ -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)
|
||||
# => #<Whale:0x00007fdd4aab02a0>
|
||||
|
||||
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)
|
||||
|
@ -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<Boolean>',
|
||||
# :'Array<Date>',
|
||||
# :'Array<Float>',
|
||||
# :'Array<Integer>',
|
||||
# :'Array<String>',
|
||||
# :'Array<Time>',
|
||||
# :'Boolean',
|
||||
# :'Date',
|
||||
# :'Float',
|
||||
# :'Integer',
|
||||
# :'String',
|
||||
# :'Time'
|
||||
# ]
|
||||
```
|
||||
|
||||
### build
|
||||
|
||||
Find the appropriate object from the `openapi_one_of` list and casts the data into it.
|
||||
|
||||
#### Example
|
||||
|
||||
```ruby
|
||||
require 'petstore'
|
||||
|
||||
Petstore::OneOfPrimitiveTypes.build(data)
|
||||
# => #<Array<Boolean>:0x00007fdd4aab02a0>
|
||||
|
||||
Petstore::OneOfPrimitiveTypes.build(data_that_doesnt_match)
|
||||
# => nil
|
||||
```
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| **data** | **Mixed** | data to be matched against the list of oneOf items |
|
||||
|
||||
#### Return type
|
||||
|
||||
- `Array<Boolean>`
|
||||
- `Array<Date>`
|
||||
- `Array<Float>`
|
||||
- `Array<Integer>`
|
||||
- `Array<String>`
|
||||
- `Array<Time>`
|
||||
- `Boolean`
|
||||
- `Date`
|
||||
- `Float`
|
||||
- `Integer`
|
||||
- `String`
|
||||
- `Time`
|
||||
- `nil` (if no type matches)
|
||||
|
@ -0,0 +1,24 @@
|
||||
# Petstore::PropertyNameMapping
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
| ---- | ---- | ----------- | ----- |
|
||||
| **http_debug_operation** | **String** | | [optional] |
|
||||
| **_type** | **String** | | [optional] |
|
||||
| **type** | **String** | | [optional] |
|
||||
| **type_** | **String** | | [optional] |
|
||||
|
||||
## Example
|
||||
|
||||
```ruby
|
||||
require 'petstore'
|
||||
|
||||
instance = Petstore::PropertyNameMapping.new(
|
||||
http_debug_operation: null,
|
||||
_type: null,
|
||||
type: null,
|
||||
type_: null
|
||||
)
|
||||
```
|
||||
|
22
samples/client/petstore/ruby-faraday/docs/Whale.md
Normal file
22
samples/client/petstore/ruby-faraday/docs/Whale.md
Normal file
@ -0,0 +1,22 @@
|
||||
# Petstore::Whale
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
| ---- | ---- | ----------- | ----- |
|
||||
| **has_baleen** | **Boolean** | | [optional] |
|
||||
| **has_teeth** | **Boolean** | | [optional] |
|
||||
| **classname** | **String** | | |
|
||||
|
||||
## Example
|
||||
|
||||
```ruby
|
||||
require 'petstore'
|
||||
|
||||
instance = Petstore::Whale.new(
|
||||
has_baleen: null,
|
||||
has_teeth: null,
|
||||
classname: null
|
||||
)
|
||||
```
|
||||
|
20
samples/client/petstore/ruby-faraday/docs/Zebra.md
Normal file
20
samples/client/petstore/ruby-faraday/docs/Zebra.md
Normal file
@ -0,0 +1,20 @@
|
||||
# Petstore::Zebra
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
| ---- | ---- | ----------- | ----- |
|
||||
| **type** | **String** | | [optional] |
|
||||
| **classname** | **String** | | |
|
||||
|
||||
## Example
|
||||
|
||||
```ruby
|
||||
require 'petstore'
|
||||
|
||||
instance = Petstore::Zebra.new(
|
||||
type: null,
|
||||
classname: null
|
||||
)
|
||||
```
|
||||
|
@ -28,6 +28,7 @@ require 'petstore/models/capitalization'
|
||||
require 'petstore/models/category'
|
||||
require 'petstore/models/class_model'
|
||||
require 'petstore/models/client'
|
||||
require 'petstore/models/cow'
|
||||
require 'petstore/models/deprecated_object'
|
||||
require 'petstore/models/enum_arrays'
|
||||
require 'petstore/models/enum_class'
|
||||
@ -41,6 +42,9 @@ require 'petstore/models/format_test'
|
||||
require 'petstore/models/has_only_read_only'
|
||||
require 'petstore/models/health_check_result'
|
||||
require 'petstore/models/list'
|
||||
require 'petstore/models/mammal'
|
||||
require 'petstore/models/mammal_anyof'
|
||||
require 'petstore/models/mammal_without_discriminator'
|
||||
require 'petstore/models/map_test'
|
||||
require 'petstore/models/mixed_properties_and_additional_properties_class'
|
||||
require 'petstore/models/model200_response'
|
||||
@ -49,6 +53,7 @@ require 'petstore/models/name'
|
||||
require 'petstore/models/nullable_class'
|
||||
require 'petstore/models/number_only'
|
||||
require 'petstore/models/object_with_deprecated_fields'
|
||||
require 'petstore/models/one_of_primitive_types'
|
||||
require 'petstore/models/order'
|
||||
require 'petstore/models/outer_composite'
|
||||
require 'petstore/models/outer_enum'
|
||||
@ -56,16 +61,17 @@ require 'petstore/models/outer_enum_default_value'
|
||||
require 'petstore/models/outer_enum_integer'
|
||||
require 'petstore/models/outer_enum_integer_default_value'
|
||||
require 'petstore/models/outer_object_with_enum_property'
|
||||
require 'petstore/models/parent_with_nullable'
|
||||
require 'petstore/models/pet'
|
||||
require 'petstore/models/property_name_mapping'
|
||||
require 'petstore/models/read_only_first'
|
||||
require 'petstore/models/single_ref_type'
|
||||
require 'petstore/models/special_model_name'
|
||||
require 'petstore/models/tag'
|
||||
require 'petstore/models/test_inline_freeform_additional_properties_request'
|
||||
require 'petstore/models/user'
|
||||
require 'petstore/models/whale'
|
||||
require 'petstore/models/zebra'
|
||||
require 'petstore/models/cat'
|
||||
require 'petstore/models/child_with_nullable'
|
||||
require 'petstore/models/dog'
|
||||
|
||||
# APIs
|
||||
|
@ -513,6 +513,87 @@ module Petstore
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# parameter name mapping test
|
||||
# @param _type [Integer] _type
|
||||
# @param type [String] type
|
||||
# @param type_ [String] type_
|
||||
# @param http_debug_option [String] http debug option (to test parameter naming option)
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
def get_parameter_name_mapping(_type, type, type_, http_debug_option, opts = {})
|
||||
get_parameter_name_mapping_with_http_info(_type, type, type_, http_debug_option, opts)
|
||||
nil
|
||||
end
|
||||
|
||||
# parameter name mapping test
|
||||
# @param _type [Integer] _type
|
||||
# @param type [String] type
|
||||
# @param type_ [String] type_
|
||||
# @param http_debug_option [String] http debug option (to test parameter naming option)
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
||||
def get_parameter_name_mapping_with_http_info(_type, type, type_, http_debug_option, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug 'Calling API: FakeApi.get_parameter_name_mapping ...'
|
||||
end
|
||||
# verify the required parameter '_type' is set
|
||||
if @api_client.config.client_side_validation && _type.nil?
|
||||
fail ArgumentError, "Missing the required parameter '_type' when calling FakeApi.get_parameter_name_mapping"
|
||||
end
|
||||
# verify the required parameter 'type' is set
|
||||
if @api_client.config.client_side_validation && type.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'type' when calling FakeApi.get_parameter_name_mapping"
|
||||
end
|
||||
# verify the required parameter 'type_' is set
|
||||
if @api_client.config.client_side_validation && type_.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'type_' when calling FakeApi.get_parameter_name_mapping"
|
||||
end
|
||||
# verify the required parameter 'http_debug_option' is set
|
||||
if @api_client.config.client_side_validation && http_debug_option.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'http_debug_option' when calling FakeApi.get_parameter_name_mapping"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = '/fake/parameter-name-mapping'
|
||||
|
||||
# query parameters
|
||||
query_params = opts[:query_params] || {}
|
||||
query_params[:'type'] = type
|
||||
query_params[:'http_debug_option'] = http_debug_option
|
||||
|
||||
# header parameters
|
||||
header_params = opts[:header_params] || {}
|
||||
header_params['_type'] = _type
|
||||
header_params['type_'] = type_
|
||||
|
||||
# form parameters
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = opts[:debug_body]
|
||||
|
||||
# return_type
|
||||
return_type = opts[:debug_return_type]
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:debug_auth_names] || []
|
||||
|
||||
new_options = opts.merge(
|
||||
:operation => :"FakeApi.get_parameter_name_mapping",
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names,
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: FakeApi#get_parameter_name_mapping\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# test referenced additionalProperties
|
||||
#
|
||||
# @param request_body [Hash<String, Object>] request body
|
||||
@ -1426,72 +1507,6 @@ module Petstore
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# test nullable parent property
|
||||
#
|
||||
# @param child_with_nullable [ChildWithNullable] request body
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
def test_nullable(child_with_nullable, opts = {})
|
||||
test_nullable_with_http_info(child_with_nullable, opts)
|
||||
nil
|
||||
end
|
||||
|
||||
# test nullable parent property
|
||||
#
|
||||
# @param child_with_nullable [ChildWithNullable] request body
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
||||
def test_nullable_with_http_info(child_with_nullable, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug 'Calling API: FakeApi.test_nullable ...'
|
||||
end
|
||||
# verify the required parameter 'child_with_nullable' is set
|
||||
if @api_client.config.client_side_validation && child_with_nullable.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'child_with_nullable' when calling FakeApi.test_nullable"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = '/fake/nullable'
|
||||
|
||||
# query parameters
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = opts[:header_params] || {}
|
||||
# HTTP header 'Content-Type'
|
||||
content_type = @api_client.select_header_content_type(['application/json'])
|
||||
if !content_type.nil?
|
||||
header_params['Content-Type'] = content_type
|
||||
end
|
||||
|
||||
# form parameters
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = opts[:debug_body] || @api_client.object_to_http_body(child_with_nullable)
|
||||
|
||||
# return_type
|
||||
return_type = opts[:debug_return_type]
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:debug_auth_names] || []
|
||||
|
||||
new_options = opts.merge(
|
||||
:operation => :"FakeApi.test_nullable",
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names,
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: FakeApi#test_nullable\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# To test the collection format in query parameters
|
||||
# @param pipe [Array<String>]
|
||||
# @param ioutil [Array<String>]
|
||||
|
@ -330,6 +330,20 @@ module Petstore
|
||||
{
|
||||
url: "https://127.0.0.1/no_varaible",
|
||||
description: "The local server without variables",
|
||||
},
|
||||
{
|
||||
url: "http://server.{version}.openapi-generator.tech",
|
||||
description: "The openapi-generator test server",
|
||||
variables: {
|
||||
version: {
|
||||
description: "target server",
|
||||
default_value: "v2",
|
||||
enum_values: [
|
||||
"v1",
|
||||
"v2"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
end
|
||||
@ -367,6 +381,114 @@ module Petstore
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
url: "http://path.{version}.test.openapi-generator.tech/v2",
|
||||
description: "test server with variables",
|
||||
variables: {
|
||||
version: {
|
||||
description: "target server",
|
||||
default_value: "v2",
|
||||
enum_values: [
|
||||
"v1",
|
||||
"v2"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"PetApi.delete_pet": [
|
||||
{
|
||||
url: "http://petstore.swagger.io/v2",
|
||||
description: "No description provided",
|
||||
},
|
||||
{
|
||||
url: "http://path-server-test.petstore.local/v2",
|
||||
description: "No description provided",
|
||||
},
|
||||
{
|
||||
url: "http://{server}.swagger.io:{port}/v2",
|
||||
description: "test server with variables",
|
||||
variables: {
|
||||
server: {
|
||||
description: "target server",
|
||||
default_value: "petstore",
|
||||
enum_values: [
|
||||
"petstore",
|
||||
"qa-petstore",
|
||||
"dev-petstore"
|
||||
]
|
||||
},
|
||||
port: {
|
||||
description: "No description provided",
|
||||
default_value: "80",
|
||||
enum_values: [
|
||||
"80",
|
||||
"8080"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
url: "http://path.{version}.test.openapi-generator.tech/v2",
|
||||
description: "test server with variables",
|
||||
variables: {
|
||||
version: {
|
||||
description: "target server",
|
||||
default_value: "v2",
|
||||
enum_values: [
|
||||
"v1",
|
||||
"v2"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"PetApi.get_pet_by_id": [
|
||||
{
|
||||
url: "http://petstore.swagger.io/v2",
|
||||
description: "No description provided",
|
||||
},
|
||||
{
|
||||
url: "http://path-server-test.petstore.local/v2",
|
||||
description: "No description provided",
|
||||
},
|
||||
{
|
||||
url: "http://{server}.swagger.io:{port}/v2",
|
||||
description: "test server with variables",
|
||||
variables: {
|
||||
server: {
|
||||
description: "target server",
|
||||
default_value: "petstore",
|
||||
enum_values: [
|
||||
"petstore",
|
||||
"qa-petstore",
|
||||
"dev-petstore"
|
||||
]
|
||||
},
|
||||
port: {
|
||||
description: "No description provided",
|
||||
default_value: "80",
|
||||
enum_values: [
|
||||
"80",
|
||||
"8080"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
url: "http://path.{version}.test.openapi-generator.tech/v2",
|
||||
description: "test server with variables",
|
||||
variables: {
|
||||
version: {
|
||||
description: "target server",
|
||||
default_value: "v2",
|
||||
enum_values: [
|
||||
"v1",
|
||||
"v2"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"PetApi.update_pet": [
|
||||
@ -400,6 +522,67 @@ module Petstore
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
url: "http://path.{version}.test.openapi-generator.tech/v2",
|
||||
description: "test server with variables",
|
||||
variables: {
|
||||
version: {
|
||||
description: "target server",
|
||||
default_value: "v2",
|
||||
enum_values: [
|
||||
"v1",
|
||||
"v2"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"PetApi.update_pet_with_form": [
|
||||
{
|
||||
url: "http://petstore.swagger.io/v2",
|
||||
description: "No description provided",
|
||||
},
|
||||
{
|
||||
url: "http://path-server-test.petstore.local/v2",
|
||||
description: "No description provided",
|
||||
},
|
||||
{
|
||||
url: "http://{server}.swagger.io:{port}/v2",
|
||||
description: "test server with variables",
|
||||
variables: {
|
||||
server: {
|
||||
description: "target server",
|
||||
default_value: "petstore",
|
||||
enum_values: [
|
||||
"petstore",
|
||||
"qa-petstore",
|
||||
"dev-petstore"
|
||||
]
|
||||
},
|
||||
port: {
|
||||
description: "No description provided",
|
||||
default_value: "80",
|
||||
enum_values: [
|
||||
"80",
|
||||
"8080"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
url: "http://path.{version}.test.openapi-generator.tech/v2",
|
||||
description: "test server with variables",
|
||||
variables: {
|
||||
version: {
|
||||
description: "target server",
|
||||
default_value: "v2",
|
||||
enum_values: [
|
||||
"v1",
|
||||
"v2"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
}
|
||||
|
@ -0,0 +1,40 @@
|
||||
=begin
|
||||
#OpenAPI Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
require 'time'
|
||||
|
||||
module Petstore
|
||||
class Cow
|
||||
BLACK_AND_WHITE_COW = "BlackAndWhiteCow".freeze
|
||||
BROWN_COW = "BrownCow".freeze
|
||||
|
||||
def self.all_vars
|
||||
@all_vars ||= [BLACK_AND_WHITE_COW, BROWN_COW].freeze
|
||||
end
|
||||
|
||||
# Builds the enum from string
|
||||
# @param [String] The enum value in the form of the string
|
||||
# @return [String] The enum value
|
||||
def self.build_from_hash(value)
|
||||
new.build_from_hash(value)
|
||||
end
|
||||
|
||||
# Builds the enum from string
|
||||
# @param [String] The enum value in the form of the string
|
||||
# @return [String] The enum value
|
||||
def build_from_hash(value)
|
||||
return value if Cow.all_vars.include?(value)
|
||||
raise "Invalid ENUM value #{value} for class #Cow"
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,43 @@
|
||||
=begin
|
||||
#OpenAPI Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
require 'time'
|
||||
|
||||
module Petstore
|
||||
module Mammal
|
||||
class << self
|
||||
# List of class defined in oneOf (OpenAPI v3)
|
||||
def openapi_one_of
|
||||
[
|
||||
:'Whale',
|
||||
:'Zebra'
|
||||
]
|
||||
end
|
||||
|
||||
# Discriminator's property name (OpenAPI v3)
|
||||
def openapi_discriminator_name
|
||||
:'classname'
|
||||
end
|
||||
|
||||
# Builds the object
|
||||
# @param [Mixed] Data to be matched against the list of oneOf items
|
||||
# @return [Object] Returns the model or the data itself
|
||||
def build(data)
|
||||
discriminator_value = data[openapi_discriminator_name]
|
||||
return nil if discriminator_value.nil?
|
||||
Petstore.const_get(discriminator_value).build_from_hash(data)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,103 @@
|
||||
=begin
|
||||
#OpenAPI Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
require 'time'
|
||||
|
||||
module Petstore
|
||||
module MammalAnyof
|
||||
class << self
|
||||
# List of class defined in anyOf (OpenAPI v3)
|
||||
def openapi_any_of
|
||||
[
|
||||
:'Whale',
|
||||
:'Zebra'
|
||||
]
|
||||
end
|
||||
|
||||
# Builds the object
|
||||
# @param [Mixed] Data to be matched against the list of anyOf items
|
||||
# @return [Object] Returns the model or the data itself
|
||||
def build(data)
|
||||
# Go through the list of anyOf items and attempt to identify the appropriate one.
|
||||
# Note:
|
||||
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
|
||||
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
|
||||
# - TODO: scalar values are de facto behaving as if they were nullable.
|
||||
# - TODO: logging when debugging is set.
|
||||
openapi_any_of.each do |klass|
|
||||
begin
|
||||
next if klass == :AnyType # "nullable: true"
|
||||
return find_and_cast_into_type(klass, data)
|
||||
rescue # rescue all errors so we keep iterating even if the current item lookup raises
|
||||
end
|
||||
end
|
||||
|
||||
openapi_any_of.include?(:AnyType) ? data : nil
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
SchemaMismatchError = Class.new(StandardError)
|
||||
|
||||
# Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
|
||||
def find_and_cast_into_type(klass, data)
|
||||
return if data.nil?
|
||||
|
||||
case klass.to_s
|
||||
when 'Boolean'
|
||||
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
|
||||
when 'Float'
|
||||
return data if data.instance_of?(Float)
|
||||
when 'Integer'
|
||||
return data if data.instance_of?(Integer)
|
||||
when 'Time'
|
||||
return Time.parse(data)
|
||||
when 'Date'
|
||||
return Date.iso8601(data)
|
||||
when 'String'
|
||||
return data if data.instance_of?(String)
|
||||
when 'Object' # "type: object"
|
||||
return data if data.instance_of?(Hash)
|
||||
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
|
||||
if data.instance_of?(Array)
|
||||
sub_type = Regexp.last_match[:sub_type]
|
||||
return data.map { |item| find_and_cast_into_type(sub_type, item) }
|
||||
end
|
||||
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
|
||||
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
|
||||
sub_type = Regexp.last_match[:sub_type]
|
||||
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
|
||||
end
|
||||
else # model
|
||||
const = Petstore.const_get(klass)
|
||||
if const
|
||||
if const.respond_to?(:openapi_any_of) # nested anyOf model
|
||||
model = const.build(data)
|
||||
return model if model
|
||||
else
|
||||
# raise if data contains keys that are not known to the model
|
||||
raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
|
||||
model = const.build_from_hash(data)
|
||||
return model if model
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
raise # if no match by now, raise
|
||||
rescue
|
||||
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,104 @@
|
||||
=begin
|
||||
#OpenAPI Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
require 'time'
|
||||
|
||||
module Petstore
|
||||
module MammalWithoutDiscriminator
|
||||
class << self
|
||||
# List of class defined in oneOf (OpenAPI v3)
|
||||
def openapi_one_of
|
||||
[
|
||||
:'Whale',
|
||||
:'Zebra'
|
||||
]
|
||||
end
|
||||
|
||||
# Builds the object
|
||||
# @param [Mixed] Data to be matched against the list of oneOf items
|
||||
# @return [Object] Returns the model or the data itself
|
||||
def build(data)
|
||||
# Go through the list of oneOf items and attempt to identify the appropriate one.
|
||||
# Note:
|
||||
# - We do not attempt to check whether exactly one item matches.
|
||||
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
|
||||
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
|
||||
# - TODO: scalar values are de facto behaving as if they were nullable.
|
||||
# - TODO: logging when debugging is set.
|
||||
openapi_one_of.each do |klass|
|
||||
begin
|
||||
next if klass == :AnyType # "nullable: true"
|
||||
return find_and_cast_into_type(klass, data)
|
||||
rescue # rescue all errors so we keep iterating even if the current item lookup raises
|
||||
end
|
||||
end
|
||||
|
||||
openapi_one_of.include?(:AnyType) ? data : nil
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
SchemaMismatchError = Class.new(StandardError)
|
||||
|
||||
# Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
|
||||
def find_and_cast_into_type(klass, data)
|
||||
return if data.nil?
|
||||
|
||||
case klass.to_s
|
||||
when 'Boolean'
|
||||
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
|
||||
when 'Float'
|
||||
return data if data.instance_of?(Float)
|
||||
when 'Integer'
|
||||
return data if data.instance_of?(Integer)
|
||||
when 'Time'
|
||||
return Time.parse(data)
|
||||
when 'Date'
|
||||
return Date.iso8601(data)
|
||||
when 'String'
|
||||
return data if data.instance_of?(String)
|
||||
when 'Object' # "type: object"
|
||||
return data if data.instance_of?(Hash)
|
||||
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
|
||||
if data.instance_of?(Array)
|
||||
sub_type = Regexp.last_match[:sub_type]
|
||||
return data.map { |item| find_and_cast_into_type(sub_type, item) }
|
||||
end
|
||||
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
|
||||
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
|
||||
sub_type = Regexp.last_match[:sub_type]
|
||||
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
|
||||
end
|
||||
else # model
|
||||
const = Petstore.const_get(klass)
|
||||
if const
|
||||
if const.respond_to?(:openapi_one_of) # nested oneOf model
|
||||
model = const.build(data)
|
||||
return model if model
|
||||
else
|
||||
# raise if data contains keys that are not known to the model
|
||||
raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
|
||||
model = const.build_from_hash(data)
|
||||
return model if model
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
raise # if no match by now, raise
|
||||
rescue
|
||||
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,114 @@
|
||||
=begin
|
||||
#OpenAPI Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
require 'time'
|
||||
|
||||
module Petstore
|
||||
module OneOfPrimitiveTypes
|
||||
class << self
|
||||
# List of class defined in oneOf (OpenAPI v3)
|
||||
def openapi_one_of
|
||||
[
|
||||
:'Array<Boolean>',
|
||||
:'Array<Date>',
|
||||
:'Array<Float>',
|
||||
:'Array<Integer>',
|
||||
:'Array<String>',
|
||||
:'Array<Time>',
|
||||
:'Boolean',
|
||||
:'Date',
|
||||
:'Float',
|
||||
:'Integer',
|
||||
:'String',
|
||||
:'Time'
|
||||
]
|
||||
end
|
||||
|
||||
# Builds the object
|
||||
# @param [Mixed] Data to be matched against the list of oneOf items
|
||||
# @return [Object] Returns the model or the data itself
|
||||
def build(data)
|
||||
# Go through the list of oneOf items and attempt to identify the appropriate one.
|
||||
# Note:
|
||||
# - We do not attempt to check whether exactly one item matches.
|
||||
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
|
||||
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
|
||||
# - TODO: scalar values are de facto behaving as if they were nullable.
|
||||
# - TODO: logging when debugging is set.
|
||||
openapi_one_of.each do |klass|
|
||||
begin
|
||||
next if klass == :AnyType # "nullable: true"
|
||||
return find_and_cast_into_type(klass, data)
|
||||
rescue # rescue all errors so we keep iterating even if the current item lookup raises
|
||||
end
|
||||
end
|
||||
|
||||
openapi_one_of.include?(:AnyType) ? data : nil
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
SchemaMismatchError = Class.new(StandardError)
|
||||
|
||||
# Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
|
||||
def find_and_cast_into_type(klass, data)
|
||||
return if data.nil?
|
||||
|
||||
case klass.to_s
|
||||
when 'Boolean'
|
||||
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
|
||||
when 'Float'
|
||||
return data if data.instance_of?(Float)
|
||||
when 'Integer'
|
||||
return data if data.instance_of?(Integer)
|
||||
when 'Time'
|
||||
return Time.parse(data)
|
||||
when 'Date'
|
||||
return Date.iso8601(data)
|
||||
when 'String'
|
||||
return data if data.instance_of?(String)
|
||||
when 'Object' # "type: object"
|
||||
return data if data.instance_of?(Hash)
|
||||
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
|
||||
if data.instance_of?(Array)
|
||||
sub_type = Regexp.last_match[:sub_type]
|
||||
return data.map { |item| find_and_cast_into_type(sub_type, item) }
|
||||
end
|
||||
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
|
||||
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
|
||||
sub_type = Regexp.last_match[:sub_type]
|
||||
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
|
||||
end
|
||||
else # model
|
||||
const = Petstore.const_get(klass)
|
||||
if const
|
||||
if const.respond_to?(:openapi_one_of) # nested oneOf model
|
||||
model = const.build(data)
|
||||
return model if model
|
||||
else
|
||||
# raise if data contains keys that are not known to the model
|
||||
raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
|
||||
model = const.build_from_hash(data)
|
||||
return model if model
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
raise # if no match by now, raise
|
||||
rescue
|
||||
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@ -14,44 +14,31 @@ require 'date'
|
||||
require 'time'
|
||||
|
||||
module Petstore
|
||||
class ChildWithNullable < ParentWithNullable
|
||||
attr_accessor :other_property
|
||||
class PropertyNameMapping
|
||||
attr_accessor :http_debug_operation
|
||||
|
||||
class EnumAttributeValidator
|
||||
attr_reader :datatype
|
||||
attr_reader :allowable_values
|
||||
attr_accessor :_type
|
||||
|
||||
def initialize(datatype, allowable_values)
|
||||
@allowable_values = allowable_values.map do |value|
|
||||
case datatype.to_s
|
||||
when /Integer/i
|
||||
value.to_i
|
||||
when /Float/i
|
||||
value.to_f
|
||||
else
|
||||
value
|
||||
end
|
||||
end
|
||||
end
|
||||
attr_accessor :type
|
||||
|
||||
def valid?(value)
|
||||
!value || allowable_values.include?(value)
|
||||
end
|
||||
end
|
||||
attr_accessor :type_
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
:'other_property' => :'otherProperty'
|
||||
:'http_debug_operation' => :'http_debug_operation',
|
||||
:'_type' => :'_type',
|
||||
:'type' => :'type',
|
||||
:'type_' => :'type_'
|
||||
}
|
||||
end
|
||||
|
||||
# Returns attribute mapping this model knows about, including the ones defined in its parent(s)
|
||||
# Returns attribute mapping this model knows about
|
||||
def self.acceptable_attribute_map
|
||||
superclass.acceptable_attribute_map.merge(attribute_map)
|
||||
attribute_map
|
||||
end
|
||||
|
||||
# Returns all the JSON keys this model knows about, including the ones defined in its parent(s)
|
||||
# Returns all the JSON keys this model knows about
|
||||
def self.acceptable_attributes
|
||||
acceptable_attribute_map.values
|
||||
end
|
||||
@ -59,7 +46,10 @@ module Petstore
|
||||
# Attribute type mapping.
|
||||
def self.openapi_types
|
||||
{
|
||||
:'other_property' => :'String'
|
||||
:'http_debug_operation' => :'String',
|
||||
:'_type' => :'String',
|
||||
:'type' => :'String',
|
||||
:'type_' => :'String'
|
||||
}
|
||||
end
|
||||
|
||||
@ -69,34 +59,36 @@ module Petstore
|
||||
])
|
||||
end
|
||||
|
||||
# List of class defined in allOf (OpenAPI v3)
|
||||
def self.openapi_all_of
|
||||
[
|
||||
:'ParentWithNullable'
|
||||
]
|
||||
end
|
||||
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::ChildWithNullable` initialize method"
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::PropertyNameMapping` initialize method"
|
||||
end
|
||||
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
acceptable_attribute_map = self.class.acceptable_attribute_map
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!acceptable_attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ChildWithNullable`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::PropertyNameMapping`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
# call parent's initialize
|
||||
super(attributes)
|
||||
if attributes.key?(:'http_debug_operation')
|
||||
self.http_debug_operation = attributes[:'http_debug_operation']
|
||||
end
|
||||
|
||||
if attributes.key?(:'other_property')
|
||||
self.other_property = attributes[:'other_property']
|
||||
if attributes.key?(:'_type')
|
||||
self._type = attributes[:'_type']
|
||||
end
|
||||
|
||||
if attributes.key?(:'type')
|
||||
self.type = attributes[:'type']
|
||||
end
|
||||
|
||||
if attributes.key?(:'type_')
|
||||
self.type_ = attributes[:'type_']
|
||||
end
|
||||
end
|
||||
|
||||
@ -104,7 +96,7 @@ module Petstore
|
||||
# @return Array for valid properties with the reasons
|
||||
def list_invalid_properties
|
||||
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
||||
invalid_properties = super
|
||||
invalid_properties = Array.new
|
||||
invalid_properties
|
||||
end
|
||||
|
||||
@ -112,7 +104,7 @@ module Petstore
|
||||
# @return true if the model is valid
|
||||
def valid?
|
||||
warn '[DEPRECATED] the `valid?` method is obsolete'
|
||||
true && super
|
||||
true
|
||||
end
|
||||
|
||||
# Checks equality by comparing each attribute.
|
||||
@ -120,7 +112,10 @@ module Petstore
|
||||
def ==(o)
|
||||
return true if self.equal?(o)
|
||||
self.class == o.class &&
|
||||
other_property == o.other_property && super(o)
|
||||
http_debug_operation == o.http_debug_operation &&
|
||||
_type == o._type &&
|
||||
type == o.type &&
|
||||
type_ == o.type_
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
@ -132,7 +127,7 @@ module Petstore
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[other_property].hash
|
||||
[http_debug_operation, _type, type, type_].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
@ -140,7 +135,6 @@ module Petstore
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
super(attributes)
|
||||
attributes = attributes.transform_keys(&:to_sym)
|
||||
transformed_hash = {}
|
||||
openapi_types.each_pair do |key, type|
|
||||
@ -217,7 +211,7 @@ module Petstore
|
||||
# Returns the object in the form of hash
|
||||
# @return [Hash] Returns the object in the form of hash
|
||||
def to_hash
|
||||
hash = super
|
||||
hash = {}
|
||||
self.class.attribute_map.each_pair do |attr, param|
|
||||
value = self.send(attr)
|
||||
if value.nil?
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 6.0.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -14,25 +14,38 @@ require 'date'
|
||||
require 'time'
|
||||
|
||||
module Petstore
|
||||
class InlineResponseDefault
|
||||
attr_accessor :string
|
||||
class Whale
|
||||
attr_accessor :has_baleen
|
||||
|
||||
attr_accessor :has_teeth
|
||||
|
||||
attr_accessor :classname
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
:'string' => :'string'
|
||||
:'has_baleen' => :'hasBaleen',
|
||||
:'has_teeth' => :'hasTeeth',
|
||||
:'classname' => :'classname'
|
||||
}
|
||||
end
|
||||
|
||||
# Returns attribute mapping this model knows about
|
||||
def self.acceptable_attribute_map
|
||||
attribute_map
|
||||
end
|
||||
|
||||
# Returns all the JSON keys this model knows about
|
||||
def self.acceptable_attributes
|
||||
attribute_map.values
|
||||
acceptable_attribute_map.values
|
||||
end
|
||||
|
||||
# Attribute type mapping.
|
||||
def self.openapi_types
|
||||
{
|
||||
:'string' => :'Foo'
|
||||
:'has_baleen' => :'Boolean',
|
||||
:'has_teeth' => :'Boolean',
|
||||
:'classname' => :'String'
|
||||
}
|
||||
end
|
||||
|
||||
@ -46,41 +59,71 @@ module Petstore
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::InlineResponseDefault` initialize method"
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::Whale` initialize method"
|
||||
end
|
||||
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
acceptable_attribute_map = self.class.acceptable_attribute_map
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::InlineResponseDefault`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
if (!acceptable_attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Whale`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.key?(:'string')
|
||||
self.string = attributes[:'string']
|
||||
if attributes.key?(:'has_baleen')
|
||||
self.has_baleen = attributes[:'has_baleen']
|
||||
end
|
||||
|
||||
if attributes.key?(:'has_teeth')
|
||||
self.has_teeth = attributes[:'has_teeth']
|
||||
end
|
||||
|
||||
if attributes.key?(:'classname')
|
||||
self.classname = attributes[:'classname']
|
||||
else
|
||||
self.classname = nil
|
||||
end
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
# @return Array for valid properties with the reasons
|
||||
def list_invalid_properties
|
||||
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
||||
invalid_properties = Array.new
|
||||
if @classname.nil?
|
||||
invalid_properties.push('invalid value for "classname", classname cannot be nil.')
|
||||
end
|
||||
|
||||
invalid_properties
|
||||
end
|
||||
|
||||
# Check to see if the all the properties in the model are valid
|
||||
# @return true if the model is valid
|
||||
def valid?
|
||||
warn '[DEPRECATED] the `valid?` method is obsolete'
|
||||
return false if @classname.nil?
|
||||
true
|
||||
end
|
||||
|
||||
# Custom attribute writer method with validation
|
||||
# @param [Object] classname Value to be assigned
|
||||
def classname=(classname)
|
||||
if classname.nil?
|
||||
fail ArgumentError, 'classname cannot be nil'
|
||||
end
|
||||
|
||||
@classname = classname
|
||||
end
|
||||
|
||||
# Checks equality by comparing each attribute.
|
||||
# @param [Object] Object to be compared
|
||||
def ==(o)
|
||||
return true if self.equal?(o)
|
||||
self.class == o.class &&
|
||||
string == o.string
|
||||
has_baleen == o.has_baleen &&
|
||||
has_teeth == o.has_teeth &&
|
||||
classname == o.classname
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
@ -92,44 +135,37 @@ module Petstore
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[string].hash
|
||||
[has_baleen, has_teeth, classname].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def build_from_hash(attributes)
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
attributes = attributes.transform_keys(&:to_sym)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
||||
self.send("#{key}=", nil)
|
||||
transformed_hash = {}
|
||||
openapi_types.each_pair do |key, type|
|
||||
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
||||
transformed_hash["#{key}"] = nil
|
||||
elsif type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the attribute
|
||||
# is documented as an array but the input is not
|
||||
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
||||
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
||||
if attributes[attribute_map[key]].is_a?(Array)
|
||||
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
||||
end
|
||||
elsif !attributes[self.class.attribute_map[key]].nil?
|
||||
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
||||
elsif !attributes[attribute_map[key]].nil?
|
||||
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
||||
end
|
||||
end
|
||||
|
||||
self
|
||||
new(transformed_hash)
|
||||
end
|
||||
|
||||
# Deserializes the data based on type
|
||||
# @param string type Data type
|
||||
# @param string value Value to be deserialized
|
||||
# @return [Object] Deserialized data
|
||||
def _deserialize(type, value)
|
||||
def self._deserialize(type, value)
|
||||
case type.to_sym
|
||||
when :Time
|
||||
Time.parse(value)
|
||||
@ -164,7 +200,7 @@ module Petstore
|
||||
else # model
|
||||
# models (e.g. Pet) or oneOf
|
||||
klass = Petstore.const_get(type)
|
||||
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
||||
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
@ -14,10 +14,10 @@ require 'date'
|
||||
require 'time'
|
||||
|
||||
module Petstore
|
||||
class ParentWithNullable
|
||||
class Zebra
|
||||
attr_accessor :type
|
||||
|
||||
attr_accessor :nullable_property
|
||||
attr_accessor :classname
|
||||
|
||||
class EnumAttributeValidator
|
||||
attr_reader :datatype
|
||||
@ -45,7 +45,7 @@ module Petstore
|
||||
def self.attribute_map
|
||||
{
|
||||
:'type' => :'type',
|
||||
:'nullable_property' => :'nullableProperty'
|
||||
:'classname' => :'classname'
|
||||
}
|
||||
end
|
||||
|
||||
@ -63,34 +63,28 @@ module Petstore
|
||||
def self.openapi_types
|
||||
{
|
||||
:'type' => :'String',
|
||||
:'nullable_property' => :'String'
|
||||
:'classname' => :'String'
|
||||
}
|
||||
end
|
||||
|
||||
# List of attributes with nullable: true
|
||||
def self.openapi_nullable
|
||||
Set.new([
|
||||
:'nullable_property'
|
||||
])
|
||||
end
|
||||
|
||||
# discriminator's property name in OpenAPI v3
|
||||
def self.openapi_discriminator_name
|
||||
:'type'
|
||||
end
|
||||
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::ParentWithNullable` initialize method"
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::Zebra` initialize method"
|
||||
end
|
||||
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
acceptable_attribute_map = self.class.acceptable_attribute_map
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!acceptable_attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ParentWithNullable`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Zebra`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
@ -99,8 +93,10 @@ module Petstore
|
||||
self.type = attributes[:'type']
|
||||
end
|
||||
|
||||
if attributes.key?(:'nullable_property')
|
||||
self.nullable_property = attributes[:'nullable_property']
|
||||
if attributes.key?(:'classname')
|
||||
self.classname = attributes[:'classname']
|
||||
else
|
||||
self.classname = nil
|
||||
end
|
||||
end
|
||||
|
||||
@ -109,6 +105,10 @@ module Petstore
|
||||
def list_invalid_properties
|
||||
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
||||
invalid_properties = Array.new
|
||||
if @classname.nil?
|
||||
invalid_properties.push('invalid value for "classname", classname cannot be nil.')
|
||||
end
|
||||
|
||||
invalid_properties
|
||||
end
|
||||
|
||||
@ -116,28 +116,39 @@ module Petstore
|
||||
# @return true if the model is valid
|
||||
def valid?
|
||||
warn '[DEPRECATED] the `valid?` method is obsolete'
|
||||
type_validator = EnumAttributeValidator.new('String', ["ChildWithNullable"])
|
||||
type_validator = EnumAttributeValidator.new('String', ["plains", "mountain", "grevys"])
|
||||
return false unless type_validator.valid?(@type)
|
||||
return false if @classname.nil?
|
||||
true
|
||||
end
|
||||
|
||||
# Custom attribute writer method checking allowed values (enum).
|
||||
# @param [Object] type Object to be assigned
|
||||
def type=(type)
|
||||
validator = EnumAttributeValidator.new('String', ["ChildWithNullable"])
|
||||
validator = EnumAttributeValidator.new('String', ["plains", "mountain", "grevys"])
|
||||
unless validator.valid?(type)
|
||||
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
||||
end
|
||||
@type = type
|
||||
end
|
||||
|
||||
# Custom attribute writer method with validation
|
||||
# @param [Object] classname Value to be assigned
|
||||
def classname=(classname)
|
||||
if classname.nil?
|
||||
fail ArgumentError, 'classname cannot be nil'
|
||||
end
|
||||
|
||||
@classname = classname
|
||||
end
|
||||
|
||||
# Checks equality by comparing each attribute.
|
||||
# @param [Object] Object to be compared
|
||||
def ==(o)
|
||||
return true if self.equal?(o)
|
||||
self.class == o.class &&
|
||||
type == o.type &&
|
||||
nullable_property == o.nullable_property
|
||||
classname == o.classname
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
@ -149,7 +160,7 @@ module Petstore
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[type, nullable_property].hash
|
||||
[type, classname].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
@ -70,7 +70,7 @@ describe Petstore::Configuration do
|
||||
}
|
||||
expect {
|
||||
config.base_url(:'PetApi.add_pet')
|
||||
}.to raise_error(ArgumentError, 'Invalid index 10 when selecting the server. Must not be nil and must be less than 3')
|
||||
}.to raise_error(ArgumentError, 'Invalid index 10 when selecting the server. Must not be nil and must be less than 4')
|
||||
end
|
||||
|
||||
it 'should remove trailing slashes' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::AdditionalPropertiesClass do
|
||||
let(:instance) { Petstore::AdditionalPropertiesClass.new }
|
||||
#let(:instance) { Petstore::AdditionalPropertiesClass.new }
|
||||
|
||||
describe 'test an instance of AdditionalPropertiesClass' do
|
||||
it 'should create an instance of AdditionalPropertiesClass' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::AllOfWithSingleRef do
|
||||
let(:instance) { Petstore::AllOfWithSingleRef.new }
|
||||
#let(:instance) { Petstore::AllOfWithSingleRef.new }
|
||||
|
||||
describe 'test an instance of AllOfWithSingleRef' do
|
||||
it 'should create an instance of AllOfWithSingleRef' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::Animal do
|
||||
let(:instance) { Petstore::Animal.new }
|
||||
#let(:instance) { Petstore::Animal.new }
|
||||
|
||||
describe 'test an instance of Animal' do
|
||||
it 'should create an instance of Animal' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::ApiResponse do
|
||||
let(:instance) { Petstore::ApiResponse.new }
|
||||
#let(:instance) { Petstore::ApiResponse.new }
|
||||
|
||||
describe 'test an instance of ApiResponse' do
|
||||
it 'should create an instance of ApiResponse' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::ArrayOfArrayOfNumberOnly do
|
||||
let(:instance) { Petstore::ArrayOfArrayOfNumberOnly.new }
|
||||
#let(:instance) { Petstore::ArrayOfArrayOfNumberOnly.new }
|
||||
|
||||
describe 'test an instance of ArrayOfArrayOfNumberOnly' do
|
||||
it 'should create an instance of ArrayOfArrayOfNumberOnly' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::ArrayOfNumberOnly do
|
||||
let(:instance) { Petstore::ArrayOfNumberOnly.new }
|
||||
#let(:instance) { Petstore::ArrayOfNumberOnly.new }
|
||||
|
||||
describe 'test an instance of ArrayOfNumberOnly' do
|
||||
it 'should create an instance of ArrayOfNumberOnly' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::ArrayTest do
|
||||
let(:instance) { Petstore::ArrayTest.new }
|
||||
#let(:instance) { Petstore::ArrayTest.new }
|
||||
|
||||
describe 'test an instance of ArrayTest' do
|
||||
it 'should create an instance of ArrayTest' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::Capitalization do
|
||||
let(:instance) { Petstore::Capitalization.new }
|
||||
#let(:instance) { Petstore::Capitalization.new }
|
||||
|
||||
describe 'test an instance of Capitalization' do
|
||||
it 'should create an instance of Capitalization' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::Cat do
|
||||
let(:instance) { Petstore::Cat.new }
|
||||
#let(:instance) { Petstore::Cat.new }
|
||||
|
||||
describe 'test an instance of Cat' do
|
||||
it 'should create an instance of Cat' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::Category do
|
||||
let(:instance) { Petstore::Category.new }
|
||||
#let(:instance) { Petstore::Category.new }
|
||||
|
||||
describe 'test an instance of Category' do
|
||||
it 'should create an instance of Category' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::ClassModel do
|
||||
let(:instance) { Petstore::ClassModel.new }
|
||||
#let(:instance) { Petstore::ClassModel.new }
|
||||
|
||||
describe 'test an instance of ClassModel' do
|
||||
it 'should create an instance of ClassModel' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::Client do
|
||||
let(:instance) { Petstore::Client.new }
|
||||
#let(:instance) { Petstore::Client.new }
|
||||
|
||||
describe 'test an instance of Client' do
|
||||
it 'should create an instance of Client' do
|
||||
|
30
samples/client/petstore/ruby-faraday/spec/models/cow_spec.rb
Normal file
30
samples/client/petstore/ruby-faraday/spec/models/cow_spec.rb
Normal file
@ -0,0 +1,30 @@
|
||||
=begin
|
||||
#OpenAPI Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'spec_helper'
|
||||
require 'json'
|
||||
require 'date'
|
||||
|
||||
# Unit tests for Petstore::Cow
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::Cow do
|
||||
#let(:instance) { Petstore::Cow.new }
|
||||
|
||||
describe 'test an instance of Cow' do
|
||||
it 'should create an instance of Cow' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::Cow)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::DeprecatedObject do
|
||||
let(:instance) { Petstore::DeprecatedObject.new }
|
||||
#let(:instance) { Petstore::DeprecatedObject.new }
|
||||
|
||||
describe 'test an instance of DeprecatedObject' do
|
||||
it 'should create an instance of DeprecatedObject' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::Dog do
|
||||
let(:instance) { Petstore::Dog.new }
|
||||
#let(:instance) { Petstore::Dog.new }
|
||||
|
||||
describe 'test an instance of Dog' do
|
||||
it 'should create an instance of Dog' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::EnumArrays do
|
||||
let(:instance) { Petstore::EnumArrays.new }
|
||||
#let(:instance) { Petstore::EnumArrays.new }
|
||||
|
||||
describe 'test an instance of EnumArrays' do
|
||||
it 'should create an instance of EnumArrays' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::EnumClass do
|
||||
let(:instance) { Petstore::EnumClass.new }
|
||||
#let(:instance) { Petstore::EnumClass.new }
|
||||
|
||||
describe 'test an instance of EnumClass' do
|
||||
it 'should create an instance of EnumClass' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::EnumTest do
|
||||
let(:instance) { Petstore::EnumTest.new }
|
||||
#let(:instance) { Petstore::EnumTest.new }
|
||||
|
||||
describe 'test an instance of EnumTest' do
|
||||
it 'should create an instance of EnumTest' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::FakeBigDecimalMap200Response do
|
||||
let(:instance) { Petstore::FakeBigDecimalMap200Response.new }
|
||||
#let(:instance) { Petstore::FakeBigDecimalMap200Response.new }
|
||||
|
||||
describe 'test an instance of FakeBigDecimalMap200Response' do
|
||||
it 'should create an instance of FakeBigDecimalMap200Response' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::FileSchemaTestClass do
|
||||
let(:instance) { Petstore::FileSchemaTestClass.new }
|
||||
#let(:instance) { Petstore::FileSchemaTestClass.new }
|
||||
|
||||
describe 'test an instance of FileSchemaTestClass' do
|
||||
it 'should create an instance of FileSchemaTestClass' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::File do
|
||||
let(:instance) { Petstore::File.new }
|
||||
#let(:instance) { Petstore::File.new }
|
||||
|
||||
describe 'test an instance of File' do
|
||||
it 'should create an instance of File' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::FooGetDefaultResponse do
|
||||
let(:instance) { Petstore::FooGetDefaultResponse.new }
|
||||
#let(:instance) { Petstore::FooGetDefaultResponse.new }
|
||||
|
||||
describe 'test an instance of FooGetDefaultResponse' do
|
||||
it 'should create an instance of FooGetDefaultResponse' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::Foo do
|
||||
let(:instance) { Petstore::Foo.new }
|
||||
#let(:instance) { Petstore::Foo.new }
|
||||
|
||||
describe 'test an instance of Foo' do
|
||||
it 'should create an instance of Foo' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::FormatTest do
|
||||
let(:instance) { Petstore::FormatTest.new }
|
||||
#let(:instance) { Petstore::FormatTest.new }
|
||||
|
||||
describe 'test an instance of FormatTest' do
|
||||
it 'should create an instance of FormatTest' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::HasOnlyReadOnly do
|
||||
let(:instance) { Petstore::HasOnlyReadOnly.new }
|
||||
#let(:instance) { Petstore::HasOnlyReadOnly.new }
|
||||
|
||||
describe 'test an instance of HasOnlyReadOnly' do
|
||||
it 'should create an instance of HasOnlyReadOnly' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::HealthCheckResult do
|
||||
let(:instance) { Petstore::HealthCheckResult.new }
|
||||
#let(:instance) { Petstore::HealthCheckResult.new }
|
||||
|
||||
describe 'test an instance of HealthCheckResult' do
|
||||
it 'should create an instance of HealthCheckResult' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::List do
|
||||
let(:instance) { Petstore::List.new }
|
||||
#let(:instance) { Petstore::List.new }
|
||||
|
||||
describe 'test an instance of List' do
|
||||
it 'should create an instance of List' do
|
||||
|
@ -0,0 +1,21 @@
|
||||
=begin
|
||||
#OpenAPI Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'spec_helper'
|
||||
require 'json'
|
||||
require 'date'
|
||||
|
||||
# Unit tests for Petstore::MammalAnyof
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::MammalAnyof do
|
||||
end
|
@ -0,0 +1,38 @@
|
||||
=begin
|
||||
#OpenAPI Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'spec_helper'
|
||||
require 'json'
|
||||
require 'date'
|
||||
|
||||
# Unit tests for Petstore::Mammal
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::Mammal do
|
||||
describe '.openapi_one_of' do
|
||||
it 'lists the items referenced in the oneOf array' do
|
||||
expect(described_class.openapi_one_of).to_not be_empty
|
||||
end
|
||||
end
|
||||
|
||||
describe '.openapi_discriminator_name' do
|
||||
it 'returns the value of the "discriminator" property' do
|
||||
expect(described_class.openapi_discriminator_name).to_not be_empty
|
||||
end
|
||||
end
|
||||
|
||||
describe '.build' do
|
||||
it 'returns the correct model' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
end
|
||||
end
|
||||
end
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -14,23 +14,19 @@ require 'spec_helper'
|
||||
require 'json'
|
||||
require 'date'
|
||||
|
||||
# Unit tests for Petstore::ChildWithNullable
|
||||
# Unit tests for Petstore::MammalWithoutDiscriminator
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::ChildWithNullable do
|
||||
let(:instance) { Petstore::ChildWithNullable.new }
|
||||
|
||||
describe 'test an instance of ChildWithNullable' do
|
||||
it 'should create an instance of ChildWithNullable' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::ChildWithNullable)
|
||||
describe Petstore::MammalWithoutDiscriminator do
|
||||
describe '.openapi_one_of' do
|
||||
it 'lists the items referenced in the oneOf array' do
|
||||
expect(described_class.openapi_one_of).to_not be_empty
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "other_property"' do
|
||||
it 'should work' do
|
||||
describe '.build' do
|
||||
it 'returns the correct model' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::MapTest do
|
||||
let(:instance) { Petstore::MapTest.new }
|
||||
#let(:instance) { Petstore::MapTest.new }
|
||||
|
||||
describe 'test an instance of MapTest' do
|
||||
it 'should create an instance of MapTest' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::MixedPropertiesAndAdditionalPropertiesClass do
|
||||
let(:instance) { Petstore::MixedPropertiesAndAdditionalPropertiesClass.new }
|
||||
#let(:instance) { Petstore::MixedPropertiesAndAdditionalPropertiesClass.new }
|
||||
|
||||
describe 'test an instance of MixedPropertiesAndAdditionalPropertiesClass' do
|
||||
it 'should create an instance of MixedPropertiesAndAdditionalPropertiesClass' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::Model200Response do
|
||||
let(:instance) { Petstore::Model200Response.new }
|
||||
#let(:instance) { Petstore::Model200Response.new }
|
||||
|
||||
describe 'test an instance of Model200Response' do
|
||||
it 'should create an instance of Model200Response' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::ModelReturn do
|
||||
let(:instance) { Petstore::ModelReturn.new }
|
||||
#let(:instance) { Petstore::ModelReturn.new }
|
||||
|
||||
describe 'test an instance of ModelReturn' do
|
||||
it 'should create an instance of ModelReturn' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::Name do
|
||||
let(:instance) { Petstore::Name.new }
|
||||
#let(:instance) { Petstore::Name.new }
|
||||
|
||||
describe 'test an instance of Name' do
|
||||
it 'should create an instance of Name' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::NullableClass do
|
||||
let(:instance) { Petstore::NullableClass.new }
|
||||
#let(:instance) { Petstore::NullableClass.new }
|
||||
|
||||
describe 'test an instance of NullableClass' do
|
||||
it 'should create an instance of NullableClass' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::NumberOnly do
|
||||
let(:instance) { Petstore::NumberOnly.new }
|
||||
#let(:instance) { Petstore::NumberOnly.new }
|
||||
|
||||
describe 'test an instance of NumberOnly' do
|
||||
it 'should create an instance of NumberOnly' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::ObjectWithDeprecatedFields do
|
||||
let(:instance) { Petstore::ObjectWithDeprecatedFields.new }
|
||||
#let(:instance) { Petstore::ObjectWithDeprecatedFields.new }
|
||||
|
||||
describe 'test an instance of ObjectWithDeprecatedFields' do
|
||||
it 'should create an instance of ObjectWithDeprecatedFields' do
|
||||
|
@ -0,0 +1,32 @@
|
||||
=begin
|
||||
#OpenAPI Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'spec_helper'
|
||||
require 'json'
|
||||
require 'date'
|
||||
|
||||
# Unit tests for Petstore::OneOfPrimitiveTypes
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::OneOfPrimitiveTypes do
|
||||
describe '.openapi_one_of' do
|
||||
it 'lists the items referenced in the oneOf array' do
|
||||
expect(described_class.openapi_one_of).to_not be_empty
|
||||
end
|
||||
end
|
||||
|
||||
describe '.build' do
|
||||
it 'returns the correct model' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
end
|
||||
end
|
||||
end
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::Order do
|
||||
let(:instance) { Petstore::Order.new }
|
||||
#let(:instance) { Petstore::Order.new }
|
||||
|
||||
describe 'test an instance of Order' do
|
||||
it 'should create an instance of Order' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::OuterComposite do
|
||||
let(:instance) { Petstore::OuterComposite.new }
|
||||
#let(:instance) { Petstore::OuterComposite.new }
|
||||
|
||||
describe 'test an instance of OuterComposite' do
|
||||
it 'should create an instance of OuterComposite' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::OuterEnumDefaultValue do
|
||||
let(:instance) { Petstore::OuterEnumDefaultValue.new }
|
||||
#let(:instance) { Petstore::OuterEnumDefaultValue.new }
|
||||
|
||||
describe 'test an instance of OuterEnumDefaultValue' do
|
||||
it 'should create an instance of OuterEnumDefaultValue' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::OuterEnumIntegerDefaultValue do
|
||||
let(:instance) { Petstore::OuterEnumIntegerDefaultValue.new }
|
||||
#let(:instance) { Petstore::OuterEnumIntegerDefaultValue.new }
|
||||
|
||||
describe 'test an instance of OuterEnumIntegerDefaultValue' do
|
||||
it 'should create an instance of OuterEnumIntegerDefaultValue' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::OuterEnumInteger do
|
||||
let(:instance) { Petstore::OuterEnumInteger.new }
|
||||
#let(:instance) { Petstore::OuterEnumInteger.new }
|
||||
|
||||
describe 'test an instance of OuterEnumInteger' do
|
||||
it 'should create an instance of OuterEnumInteger' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::OuterEnum do
|
||||
let(:instance) { Petstore::OuterEnum.new }
|
||||
#let(:instance) { Petstore::OuterEnum.new }
|
||||
|
||||
describe 'test an instance of OuterEnum' do
|
||||
it 'should create an instance of OuterEnum' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::OuterObjectWithEnumProperty do
|
||||
let(:instance) { Petstore::OuterObjectWithEnumProperty.new }
|
||||
#let(:instance) { Petstore::OuterObjectWithEnumProperty.new }
|
||||
|
||||
describe 'test an instance of OuterObjectWithEnumProperty' do
|
||||
it 'should create an instance of OuterObjectWithEnumProperty' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::Pet do
|
||||
let(:instance) { Petstore::Pet.new }
|
||||
#let(:instance) { Petstore::Pet.new }
|
||||
|
||||
describe 'test an instance of Pet' do
|
||||
it 'should create an instance of Pet' do
|
||||
|
@ -0,0 +1,54 @@
|
||||
=begin
|
||||
#OpenAPI Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'spec_helper'
|
||||
require 'json'
|
||||
require 'date'
|
||||
|
||||
# Unit tests for Petstore::PropertyNameMapping
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::PropertyNameMapping do
|
||||
#let(:instance) { Petstore::PropertyNameMapping.new }
|
||||
|
||||
describe 'test an instance of PropertyNameMapping' do
|
||||
it 'should create an instance of PropertyNameMapping' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::PropertyNameMapping)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "http_debug_operation"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "_type"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "type"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "type_"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::ReadOnlyFirst do
|
||||
let(:instance) { Petstore::ReadOnlyFirst.new }
|
||||
#let(:instance) { Petstore::ReadOnlyFirst.new }
|
||||
|
||||
describe 'test an instance of ReadOnlyFirst' do
|
||||
it 'should create an instance of ReadOnlyFirst' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::SingleRefType do
|
||||
let(:instance) { Petstore::SingleRefType.new }
|
||||
#let(:instance) { Petstore::SingleRefType.new }
|
||||
|
||||
describe 'test an instance of SingleRefType' do
|
||||
it 'should create an instance of SingleRefType' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::SpecialModelName do
|
||||
let(:instance) { Petstore::SpecialModelName.new }
|
||||
#let(:instance) { Petstore::SpecialModelName.new }
|
||||
|
||||
describe 'test an instance of SpecialModelName' do
|
||||
it 'should create an instance of SpecialModelName' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::Tag do
|
||||
let(:instance) { Petstore::Tag.new }
|
||||
#let(:instance) { Petstore::Tag.new }
|
||||
|
||||
describe 'test an instance of Tag' do
|
||||
it 'should create an instance of Tag' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::TestInlineFreeformAdditionalPropertiesRequest do
|
||||
let(:instance) { Petstore::TestInlineFreeformAdditionalPropertiesRequest.new }
|
||||
#let(:instance) { Petstore::TestInlineFreeformAdditionalPropertiesRequest.new }
|
||||
|
||||
describe 'test an instance of TestInlineFreeformAdditionalPropertiesRequest' do
|
||||
it 'should create an instance of TestInlineFreeformAdditionalPropertiesRequest' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -18,7 +18,7 @@ require 'date'
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::User do
|
||||
let(:instance) { Petstore::User.new }
|
||||
#let(:instance) { Petstore::User.new }
|
||||
|
||||
describe 'test an instance of User' do
|
||||
it 'should create an instance of User' do
|
||||
|
@ -0,0 +1,48 @@
|
||||
=begin
|
||||
#OpenAPI Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'spec_helper'
|
||||
require 'json'
|
||||
require 'date'
|
||||
|
||||
# Unit tests for Petstore::Whale
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::Whale do
|
||||
#let(:instance) { Petstore::Whale.new }
|
||||
|
||||
describe 'test an instance of Whale' do
|
||||
it 'should create an instance of Whale' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::Whale)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "has_baleen"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "has_teeth"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "classname"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
Generator version: 7.11.0-SNAPSHOT
|
||||
Generator version: 7.16.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -14,30 +14,30 @@ require 'spec_helper'
|
||||
require 'json'
|
||||
require 'date'
|
||||
|
||||
# Unit tests for Petstore::ParentWithNullable
|
||||
# Unit tests for Petstore::Zebra
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::ParentWithNullable do
|
||||
let(:instance) { Petstore::ParentWithNullable.new }
|
||||
describe Petstore::Zebra do
|
||||
#let(:instance) { Petstore::Zebra.new }
|
||||
|
||||
describe 'test an instance of ParentWithNullable' do
|
||||
it 'should create an instance of ParentWithNullable' do
|
||||
describe 'test an instance of Zebra' do
|
||||
it 'should create an instance of Zebra' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::ParentWithNullable)
|
||||
#expect(instance).to be_instance_of(Petstore::Zebra)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "type"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["ChildWithNullable"])
|
||||
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["plains", "mountain", "grevys"])
|
||||
# validator.allowable_values.each do |value|
|
||||
# expect { instance.type = value }.not_to raise_error
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "nullable_property"' do
|
||||
describe 'test attribute "classname"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user