forked from loafle/openapi-generator-original
Update ruby httpx petstore test (#16753)
* update ruby httpx petstore test * fix pom * comment out ruby httpx tests
This commit is contained in:
parent
e3db882ed4
commit
23c5db602f
@ -1,7 +1,7 @@
|
||||
generatorName: ruby
|
||||
outputDir: samples/client/petstore/ruby-httpx
|
||||
library: httpx
|
||||
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
|
||||
|
2
pom.xml
2
pom.xml
@ -1165,7 +1165,7 @@
|
||||
<modules>
|
||||
<module>samples/client/petstore/ruby</module>
|
||||
<module>samples/client/petstore/ruby-faraday</module>
|
||||
<module>samples/client/petstore/ruby-httpx</module>
|
||||
<!--<module>samples/client/petstore/ruby-httpx</module>-->
|
||||
<module>samples/client/petstore/ruby-autoload</module>
|
||||
</modules>
|
||||
</profile>
|
||||
|
@ -17,7 +17,6 @@ docs/ArrayTest.md
|
||||
docs/Capitalization.md
|
||||
docs/Cat.md
|
||||
docs/Category.md
|
||||
docs/ChildWithNullable.md
|
||||
docs/ClassModel.md
|
||||
docs/Client.md
|
||||
docs/DefaultApi.md
|
||||
@ -37,6 +36,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
|
||||
@ -52,9 +54,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 +65,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,7 +89,6 @@ 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/deprecated_object.rb
|
||||
@ -102,6 +105,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
|
||||
@ -117,14 +123,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/api_client_spec.rb
|
||||
|
66
samples/client/petstore/ruby-httpx/Gemfile.lock
Normal file
66
samples/client/petstore/ruby-httpx/Gemfile.lock
Normal file
@ -0,0 +1,66 @@
|
||||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
petstore (1.0.0)
|
||||
httpx (~> 1.0, >= 1.0.0)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
ast (2.4.1)
|
||||
byebug (11.1.3)
|
||||
coderay (1.1.3)
|
||||
diff-lcs (1.4.4)
|
||||
http-2-next (1.0.0)
|
||||
httpx (1.0.1)
|
||||
http-2-next (>= 1.0.0)
|
||||
jaro_winkler (1.5.4)
|
||||
method_source (1.0.0)
|
||||
parallel (1.19.2)
|
||||
parser (2.7.1.5)
|
||||
ast (~> 2.4.1)
|
||||
pry (0.13.1)
|
||||
coderay (~> 1.1)
|
||||
method_source (~> 1.0)
|
||||
pry-byebug (3.9.0)
|
||||
byebug (~> 11.0)
|
||||
pry (~> 0.13.0)
|
||||
psych (3.2.0)
|
||||
rainbow (3.0.0)
|
||||
rake (13.0.1)
|
||||
rspec (3.9.0)
|
||||
rspec-core (~> 3.9.0)
|
||||
rspec-expectations (~> 3.9.0)
|
||||
rspec-mocks (~> 3.9.0)
|
||||
rspec-core (3.9.2)
|
||||
rspec-support (~> 3.9.3)
|
||||
rspec-expectations (3.9.2)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.9.0)
|
||||
rspec-mocks (3.9.1)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.9.0)
|
||||
rspec-support (3.9.3)
|
||||
rubocop (0.66.0)
|
||||
jaro_winkler (~> 1.5.1)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 2.5, != 2.5.1.1)
|
||||
psych (>= 3.1.0)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 1.6)
|
||||
ruby-progressbar (1.10.1)
|
||||
unicode-display_width (1.5.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
petstore!
|
||||
pry-byebug
|
||||
rake (~> 13.0.1)
|
||||
rspec (~> 3.6, >= 3.6.0)
|
||||
rubocop (~> 0.66.0)
|
||||
|
||||
BUNDLED WITH
|
||||
1.17.2
|
@ -85,6 +85,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_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 |
|
||||
*Petstore::FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params |
|
||||
@ -95,7 +96,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::FakeClassnameTags123Api* | [**test_classname**](docs/FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case
|
||||
*Petstore::PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store
|
||||
@ -133,7 +133,6 @@ 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::DeprecatedObject](docs/DeprecatedObject.md)
|
||||
@ -150,6 +149,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)
|
||||
@ -165,14 +167,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
|
||||
|
@ -1,18 +0,0 @@
|
||||
# Petstore::ChildWithNullable
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
| ---- | ---- | ----------- | ----- |
|
||||
| **other_property** | **String** | | [optional] |
|
||||
|
||||
## Example
|
||||
|
||||
```ruby
|
||||
require 'petstore'
|
||||
|
||||
instance = Petstore::ChildWithNullable.new(
|
||||
other_property: null
|
||||
)
|
||||
```
|
||||
|
@ -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_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 | |
|
||||
| [**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | |
|
||||
@ -22,7 +23,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 | |
|
||||
|
||||
|
||||
@ -544,6 +544,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_body_with_binary
|
||||
|
||||
> test_body_with_binary(body)
|
||||
@ -1246,69 +1313,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)
|
||||
|
20
samples/client/petstore/ruby-httpx/docs/InlineObject.md
Normal file
20
samples/client/petstore/ruby-httpx/docs/InlineObject.md
Normal file
@ -0,0 +1,20 @@
|
||||
# Petstore::InlineObject
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
| ---- | ---- | ----------- | ----- |
|
||||
| **name** | **String** | Updated name of the pet | [optional] |
|
||||
| **status** | **String** | Updated status of the pet | [optional] |
|
||||
|
||||
## Example
|
||||
|
||||
```ruby
|
||||
require 'petstore'
|
||||
|
||||
instance = Petstore::InlineObject.new(
|
||||
name: null,
|
||||
status: null
|
||||
)
|
||||
```
|
||||
|
20
samples/client/petstore/ruby-httpx/docs/InlineObject1.md
Normal file
20
samples/client/petstore/ruby-httpx/docs/InlineObject1.md
Normal file
@ -0,0 +1,20 @@
|
||||
# Petstore::InlineObject1
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
| ---- | ---- | ----------- | ----- |
|
||||
| **additional_metadata** | **String** | Additional data to pass to server | [optional] |
|
||||
| **file** | **File** | file to upload | [optional] |
|
||||
|
||||
## Example
|
||||
|
||||
```ruby
|
||||
require 'petstore'
|
||||
|
||||
instance = Petstore::InlineObject1.new(
|
||||
additional_metadata: null,
|
||||
file: null
|
||||
)
|
||||
```
|
||||
|
20
samples/client/petstore/ruby-httpx/docs/InlineObject2.md
Normal file
20
samples/client/petstore/ruby-httpx/docs/InlineObject2.md
Normal file
@ -0,0 +1,20 @@
|
||||
# Petstore::InlineObject2
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
| ---- | ---- | ----------- | ----- |
|
||||
| **enum_form_string_array** | **Array<String>** | Form parameter enum test (string array) | [optional] |
|
||||
| **enum_form_string** | **String** | Form parameter enum test (string) | [optional][default to '-efg'] |
|
||||
|
||||
## Example
|
||||
|
||||
```ruby
|
||||
require 'petstore'
|
||||
|
||||
instance = Petstore::InlineObject2.new(
|
||||
enum_form_string_array: null,
|
||||
enum_form_string: null
|
||||
)
|
||||
```
|
||||
|
44
samples/client/petstore/ruby-httpx/docs/InlineObject3.md
Normal file
44
samples/client/petstore/ruby-httpx/docs/InlineObject3.md
Normal file
@ -0,0 +1,44 @@
|
||||
# Petstore::InlineObject3
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
| ---- | ---- | ----------- | ----- |
|
||||
| **integer** | **Integer** | None | [optional] |
|
||||
| **int32** | **Integer** | None | [optional] |
|
||||
| **int64** | **Integer** | None | [optional] |
|
||||
| **number** | **Float** | None | |
|
||||
| **float** | **Float** | None | [optional] |
|
||||
| **double** | **Float** | None | |
|
||||
| **string** | **String** | None | [optional] |
|
||||
| **pattern_without_delimiter** | **String** | None | |
|
||||
| **byte** | **String** | None | |
|
||||
| **binary** | **File** | None | [optional] |
|
||||
| **date** | **Date** | None | [optional] |
|
||||
| **date_time** | **Time** | None | [optional] |
|
||||
| **password** | **String** | None | [optional] |
|
||||
| **callback** | **String** | None | [optional] |
|
||||
|
||||
## Example
|
||||
|
||||
```ruby
|
||||
require 'petstore'
|
||||
|
||||
instance = Petstore::InlineObject3.new(
|
||||
integer: null,
|
||||
int32: null,
|
||||
int64: null,
|
||||
number: null,
|
||||
float: null,
|
||||
double: null,
|
||||
string: null,
|
||||
pattern_without_delimiter: null,
|
||||
byte: null,
|
||||
binary: null,
|
||||
date: null,
|
||||
date_time: null,
|
||||
password: null,
|
||||
callback: null
|
||||
)
|
||||
```
|
||||
|
20
samples/client/petstore/ruby-httpx/docs/InlineObject4.md
Normal file
20
samples/client/petstore/ruby-httpx/docs/InlineObject4.md
Normal file
@ -0,0 +1,20 @@
|
||||
# Petstore::InlineObject4
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
| ---- | ---- | ----------- | ----- |
|
||||
| **param** | **String** | field1 | |
|
||||
| **param2** | **String** | field2 | |
|
||||
|
||||
## Example
|
||||
|
||||
```ruby
|
||||
require 'petstore'
|
||||
|
||||
instance = Petstore::InlineObject4.new(
|
||||
param: null,
|
||||
param2: null
|
||||
)
|
||||
```
|
||||
|
20
samples/client/petstore/ruby-httpx/docs/InlineObject5.md
Normal file
20
samples/client/petstore/ruby-httpx/docs/InlineObject5.md
Normal file
@ -0,0 +1,20 @@
|
||||
# Petstore::InlineObject5
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
| ---- | ---- | ----------- | ----- |
|
||||
| **additional_metadata** | **String** | Additional data to pass to server | [optional] |
|
||||
| **required_file** | **File** | file to upload | |
|
||||
|
||||
## Example
|
||||
|
||||
```ruby
|
||||
require 'petstore'
|
||||
|
||||
instance = Petstore::InlineObject5.new(
|
||||
additional_metadata: null,
|
||||
required_file: null
|
||||
)
|
||||
```
|
||||
|
@ -0,0 +1,18 @@
|
||||
# Petstore::InlineResponseDefault
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
| ---- | ---- | ----------- | ----- |
|
||||
| **string** | [**Foo**](Foo.md) | | [optional] |
|
||||
|
||||
## Example
|
||||
|
||||
```ruby
|
||||
require 'petstore'
|
||||
|
||||
instance = Petstore::InlineResponseDefault.new(
|
||||
string: null
|
||||
)
|
||||
```
|
||||
|
63
samples/client/petstore/ruby-httpx/docs/Mammal.md
Normal file
63
samples/client/petstore/ruby-httpx/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-httpx/docs/MammalAnyof.md
Normal file
24
samples/client/petstore/ruby-httpx/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,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-httpx/docs/Whale.md
Normal file
22
samples/client/petstore/ruby-httpx/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
|
||||
)
|
||||
```
|
||||
|
@ -1,20 +1,20 @@
|
||||
# Petstore::ParentWithNullable
|
||||
# Petstore::Zebra
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
| ---- | ---- | ----------- | ----- |
|
||||
| **type** | **String** | | [optional] |
|
||||
| **nullable_property** | **String** | | [optional] |
|
||||
| **classname** | **String** | | |
|
||||
|
||||
## Example
|
||||
|
||||
```ruby
|
||||
require 'petstore'
|
||||
|
||||
instance = Petstore::ParentWithNullable.new(
|
||||
instance = Petstore::Zebra.new(
|
||||
type: null,
|
||||
nullable_property: null
|
||||
classname: null
|
||||
)
|
||||
```
|
||||
|
1
samples/client/petstore/ruby-httpx/hello.txt
Normal file
1
samples/client/petstore/ruby-httpx/hello.txt
Normal file
@ -0,0 +1 @@
|
||||
Hello world!
|
@ -41,6 +41,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'
|
||||
@ -56,16 +59,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
|
||||
|
||||
# For this test, the body has to be a binary file.
|
||||
# @param body [File] image to upload
|
||||
# @param [Hash] opts the optional parameters
|
||||
@ -1360,72 +1441,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>]
|
||||
|
@ -284,6 +284,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
|
||||
@ -321,6 +335,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": [
|
||||
@ -354,6 +476,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,229 @@
|
||||
=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
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
require 'time'
|
||||
|
||||
module Petstore
|
||||
class InlineObject
|
||||
# Updated name of the pet
|
||||
attr_accessor :name
|
||||
|
||||
# Updated status of the pet
|
||||
attr_accessor :status
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
:'name' => :'name',
|
||||
:'status' => :'status'
|
||||
}
|
||||
end
|
||||
|
||||
# Returns all the JSON keys this model knows about
|
||||
def self.acceptable_attributes
|
||||
attribute_map.values
|
||||
end
|
||||
|
||||
# Attribute type mapping.
|
||||
def self.openapi_types
|
||||
{
|
||||
:'name' => :'String',
|
||||
:'status' => :'String'
|
||||
}
|
||||
end
|
||||
|
||||
# List of attributes with nullable: true
|
||||
def self.openapi_nullable
|
||||
Set.new([
|
||||
])
|
||||
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::InlineObject` initialize method"
|
||||
end
|
||||
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
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::InlineObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.key?(:'name')
|
||||
self.name = attributes[:'name']
|
||||
end
|
||||
|
||||
if attributes.key?(:'status')
|
||||
self.status = attributes[:'status']
|
||||
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
|
||||
invalid_properties = Array.new
|
||||
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?
|
||||
true
|
||||
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 &&
|
||||
name == o.name &&
|
||||
status == o.status
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
# @param [Object] Object to be compared
|
||||
def eql?(o)
|
||||
self == o
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[name, status].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)
|
||||
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)
|
||||
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) })
|
||||
end
|
||||
elsif !attributes[self.class.attribute_map[key]].nil?
|
||||
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
||||
end
|
||||
end
|
||||
|
||||
self
|
||||
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)
|
||||
case type.to_sym
|
||||
when :Time
|
||||
Time.parse(value)
|
||||
when :Date
|
||||
Date.parse(value)
|
||||
when :String
|
||||
value.to_s
|
||||
when :Integer
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
when :Object
|
||||
# generic object (usually a Hash), return directly
|
||||
value
|
||||
when /\AArray<(?<inner_type>.+)>\z/
|
||||
inner_type = Regexp.last_match[:inner_type]
|
||||
value.map { |v| _deserialize(inner_type, v) }
|
||||
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
||||
k_type = Regexp.last_match[:k_type]
|
||||
v_type = Regexp.last_match[:v_type]
|
||||
{}.tap do |hash|
|
||||
value.each do |k, v|
|
||||
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
||||
end
|
||||
end
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
||||
# Returns the string representation of the object
|
||||
# @return [String] String presentation of the object
|
||||
def to_s
|
||||
to_hash.to_s
|
||||
end
|
||||
|
||||
# to_body is an alias to to_hash (backward compatibility)
|
||||
# @return [Hash] Returns the object in the form of hash
|
||||
def to_body
|
||||
to_hash
|
||||
end
|
||||
|
||||
# Returns the object in the form of hash
|
||||
# @return [Hash] Returns the object in the form of hash
|
||||
def to_hash
|
||||
hash = {}
|
||||
self.class.attribute_map.each_pair do |attr, param|
|
||||
value = self.send(attr)
|
||||
if value.nil?
|
||||
is_nullable = self.class.openapi_nullable.include?(attr)
|
||||
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
||||
end
|
||||
|
||||
hash[param] = _to_hash(value)
|
||||
end
|
||||
hash
|
||||
end
|
||||
|
||||
# Outputs non-array value in the form of hash
|
||||
# For object, use to_hash. Otherwise, just return the value
|
||||
# @param [Object] value Any valid value
|
||||
# @return [Hash] Returns the value in the form of hash
|
||||
def _to_hash(value)
|
||||
if value.is_a?(Array)
|
||||
value.compact.map { |v| _to_hash(v) }
|
||||
elsif value.is_a?(Hash)
|
||||
{}.tap do |hash|
|
||||
value.each { |k, v| hash[k] = _to_hash(v) }
|
||||
end
|
||||
elsif value.respond_to? :to_hash
|
||||
value.to_hash
|
||||
else
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,229 @@
|
||||
=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
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
require 'time'
|
||||
|
||||
module Petstore
|
||||
class InlineObject1
|
||||
# Additional data to pass to server
|
||||
attr_accessor :additional_metadata
|
||||
|
||||
# file to upload
|
||||
attr_accessor :file
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
:'additional_metadata' => :'additionalMetadata',
|
||||
:'file' => :'file'
|
||||
}
|
||||
end
|
||||
|
||||
# Returns all the JSON keys this model knows about
|
||||
def self.acceptable_attributes
|
||||
attribute_map.values
|
||||
end
|
||||
|
||||
# Attribute type mapping.
|
||||
def self.openapi_types
|
||||
{
|
||||
:'additional_metadata' => :'String',
|
||||
:'file' => :'File'
|
||||
}
|
||||
end
|
||||
|
||||
# List of attributes with nullable: true
|
||||
def self.openapi_nullable
|
||||
Set.new([
|
||||
])
|
||||
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::InlineObject1` initialize method"
|
||||
end
|
||||
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
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::InlineObject1`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.key?(:'additional_metadata')
|
||||
self.additional_metadata = attributes[:'additional_metadata']
|
||||
end
|
||||
|
||||
if attributes.key?(:'file')
|
||||
self.file = attributes[:'file']
|
||||
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
|
||||
invalid_properties = Array.new
|
||||
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?
|
||||
true
|
||||
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 &&
|
||||
additional_metadata == o.additional_metadata &&
|
||||
file == o.file
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
# @param [Object] Object to be compared
|
||||
def eql?(o)
|
||||
self == o
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[additional_metadata, file].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)
|
||||
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)
|
||||
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) })
|
||||
end
|
||||
elsif !attributes[self.class.attribute_map[key]].nil?
|
||||
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
||||
end
|
||||
end
|
||||
|
||||
self
|
||||
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)
|
||||
case type.to_sym
|
||||
when :Time
|
||||
Time.parse(value)
|
||||
when :Date
|
||||
Date.parse(value)
|
||||
when :String
|
||||
value.to_s
|
||||
when :Integer
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
when :Object
|
||||
# generic object (usually a Hash), return directly
|
||||
value
|
||||
when /\AArray<(?<inner_type>.+)>\z/
|
||||
inner_type = Regexp.last_match[:inner_type]
|
||||
value.map { |v| _deserialize(inner_type, v) }
|
||||
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
||||
k_type = Regexp.last_match[:k_type]
|
||||
v_type = Regexp.last_match[:v_type]
|
||||
{}.tap do |hash|
|
||||
value.each do |k, v|
|
||||
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
||||
end
|
||||
end
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
||||
# Returns the string representation of the object
|
||||
# @return [String] String presentation of the object
|
||||
def to_s
|
||||
to_hash.to_s
|
||||
end
|
||||
|
||||
# to_body is an alias to to_hash (backward compatibility)
|
||||
# @return [Hash] Returns the object in the form of hash
|
||||
def to_body
|
||||
to_hash
|
||||
end
|
||||
|
||||
# Returns the object in the form of hash
|
||||
# @return [Hash] Returns the object in the form of hash
|
||||
def to_hash
|
||||
hash = {}
|
||||
self.class.attribute_map.each_pair do |attr, param|
|
||||
value = self.send(attr)
|
||||
if value.nil?
|
||||
is_nullable = self.class.openapi_nullable.include?(attr)
|
||||
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
||||
end
|
||||
|
||||
hash[param] = _to_hash(value)
|
||||
end
|
||||
hash
|
||||
end
|
||||
|
||||
# Outputs non-array value in the form of hash
|
||||
# For object, use to_hash. Otherwise, just return the value
|
||||
# @param [Object] value Any valid value
|
||||
# @return [Hash] Returns the value in the form of hash
|
||||
def _to_hash(value)
|
||||
if value.is_a?(Array)
|
||||
value.compact.map { |v| _to_hash(v) }
|
||||
elsif value.is_a?(Hash)
|
||||
{}.tap do |hash|
|
||||
value.each { |k, v| hash[k] = _to_hash(v) }
|
||||
end
|
||||
elsif value.respond_to? :to_hash
|
||||
value.to_hash
|
||||
else
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,267 @@
|
||||
=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
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
require 'time'
|
||||
|
||||
module Petstore
|
||||
class InlineObject2
|
||||
# Form parameter enum test (string array)
|
||||
attr_accessor :enum_form_string_array
|
||||
|
||||
# Form parameter enum test (string)
|
||||
attr_accessor :enum_form_string
|
||||
|
||||
class EnumAttributeValidator
|
||||
attr_reader :datatype
|
||||
attr_reader :allowable_values
|
||||
|
||||
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
|
||||
|
||||
def valid?(value)
|
||||
!value || allowable_values.include?(value)
|
||||
end
|
||||
end
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
:'enum_form_string_array' => :'enum_form_string_array',
|
||||
:'enum_form_string' => :'enum_form_string'
|
||||
}
|
||||
end
|
||||
|
||||
# Returns all the JSON keys this model knows about
|
||||
def self.acceptable_attributes
|
||||
attribute_map.values
|
||||
end
|
||||
|
||||
# Attribute type mapping.
|
||||
def self.openapi_types
|
||||
{
|
||||
:'enum_form_string_array' => :'Array<String>',
|
||||
:'enum_form_string' => :'String'
|
||||
}
|
||||
end
|
||||
|
||||
# List of attributes with nullable: true
|
||||
def self.openapi_nullable
|
||||
Set.new([
|
||||
])
|
||||
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::InlineObject2` initialize method"
|
||||
end
|
||||
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
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::InlineObject2`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.key?(:'enum_form_string_array')
|
||||
if (value = attributes[:'enum_form_string_array']).is_a?(Array)
|
||||
self.enum_form_string_array = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.key?(:'enum_form_string')
|
||||
self.enum_form_string = attributes[:'enum_form_string']
|
||||
else
|
||||
self.enum_form_string = '-efg'
|
||||
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
|
||||
invalid_properties = Array.new
|
||||
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?
|
||||
enum_form_string_validator = EnumAttributeValidator.new('String', ["_abc", "-efg", "(xyz)"])
|
||||
return false unless enum_form_string_validator.valid?(@enum_form_string)
|
||||
true
|
||||
end
|
||||
|
||||
# Custom attribute writer method checking allowed values (enum).
|
||||
# @param [Object] enum_form_string Object to be assigned
|
||||
def enum_form_string=(enum_form_string)
|
||||
validator = EnumAttributeValidator.new('String', ["_abc", "-efg", "(xyz)"])
|
||||
unless validator.valid?(enum_form_string)
|
||||
fail ArgumentError, "invalid value for \"enum_form_string\", must be one of #{validator.allowable_values}."
|
||||
end
|
||||
@enum_form_string = enum_form_string
|
||||
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 &&
|
||||
enum_form_string_array == o.enum_form_string_array &&
|
||||
enum_form_string == o.enum_form_string
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
# @param [Object] Object to be compared
|
||||
def eql?(o)
|
||||
self == o
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[enum_form_string_array, enum_form_string].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)
|
||||
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)
|
||||
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) })
|
||||
end
|
||||
elsif !attributes[self.class.attribute_map[key]].nil?
|
||||
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
||||
end
|
||||
end
|
||||
|
||||
self
|
||||
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)
|
||||
case type.to_sym
|
||||
when :Time
|
||||
Time.parse(value)
|
||||
when :Date
|
||||
Date.parse(value)
|
||||
when :String
|
||||
value.to_s
|
||||
when :Integer
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
when :Object
|
||||
# generic object (usually a Hash), return directly
|
||||
value
|
||||
when /\AArray<(?<inner_type>.+)>\z/
|
||||
inner_type = Regexp.last_match[:inner_type]
|
||||
value.map { |v| _deserialize(inner_type, v) }
|
||||
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
||||
k_type = Regexp.last_match[:k_type]
|
||||
v_type = Regexp.last_match[:v_type]
|
||||
{}.tap do |hash|
|
||||
value.each do |k, v|
|
||||
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
||||
end
|
||||
end
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
||||
# Returns the string representation of the object
|
||||
# @return [String] String presentation of the object
|
||||
def to_s
|
||||
to_hash.to_s
|
||||
end
|
||||
|
||||
# to_body is an alias to to_hash (backward compatibility)
|
||||
# @return [Hash] Returns the object in the form of hash
|
||||
def to_body
|
||||
to_hash
|
||||
end
|
||||
|
||||
# Returns the object in the form of hash
|
||||
# @return [Hash] Returns the object in the form of hash
|
||||
def to_hash
|
||||
hash = {}
|
||||
self.class.attribute_map.each_pair do |attr, param|
|
||||
value = self.send(attr)
|
||||
if value.nil?
|
||||
is_nullable = self.class.openapi_nullable.include?(attr)
|
||||
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
||||
end
|
||||
|
||||
hash[param] = _to_hash(value)
|
||||
end
|
||||
hash
|
||||
end
|
||||
|
||||
# Outputs non-array value in the form of hash
|
||||
# For object, use to_hash. Otherwise, just return the value
|
||||
# @param [Object] value Any valid value
|
||||
# @return [Hash] Returns the value in the form of hash
|
||||
def _to_hash(value)
|
||||
if value.is_a?(Array)
|
||||
value.compact.map { |v| _to_hash(v) }
|
||||
elsif value.is_a?(Hash)
|
||||
{}.tap do |hash|
|
||||
value.each { |k, v| hash[k] = _to_hash(v) }
|
||||
end
|
||||
elsif value.respond_to? :to_hash
|
||||
value.to_hash
|
||||
else
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,550 @@
|
||||
=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
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
require 'time'
|
||||
|
||||
module Petstore
|
||||
class InlineObject3
|
||||
# None
|
||||
attr_accessor :integer
|
||||
|
||||
# None
|
||||
attr_accessor :int32
|
||||
|
||||
# None
|
||||
attr_accessor :int64
|
||||
|
||||
# None
|
||||
attr_accessor :number
|
||||
|
||||
# None
|
||||
attr_accessor :float
|
||||
|
||||
# None
|
||||
attr_accessor :double
|
||||
|
||||
# None
|
||||
attr_accessor :string
|
||||
|
||||
# None
|
||||
attr_accessor :pattern_without_delimiter
|
||||
|
||||
# None
|
||||
attr_accessor :byte
|
||||
|
||||
# None
|
||||
attr_accessor :binary
|
||||
|
||||
# None
|
||||
attr_accessor :date
|
||||
|
||||
# None
|
||||
attr_accessor :date_time
|
||||
|
||||
# None
|
||||
attr_accessor :password
|
||||
|
||||
# None
|
||||
attr_accessor :callback
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
:'integer' => :'integer',
|
||||
:'int32' => :'int32',
|
||||
:'int64' => :'int64',
|
||||
:'number' => :'number',
|
||||
:'float' => :'float',
|
||||
:'double' => :'double',
|
||||
:'string' => :'string',
|
||||
:'pattern_without_delimiter' => :'pattern_without_delimiter',
|
||||
:'byte' => :'byte',
|
||||
:'binary' => :'binary',
|
||||
:'date' => :'date',
|
||||
:'date_time' => :'dateTime',
|
||||
:'password' => :'password',
|
||||
:'callback' => :'callback'
|
||||
}
|
||||
end
|
||||
|
||||
# Returns all the JSON keys this model knows about
|
||||
def self.acceptable_attributes
|
||||
attribute_map.values
|
||||
end
|
||||
|
||||
# Attribute type mapping.
|
||||
def self.openapi_types
|
||||
{
|
||||
:'integer' => :'Integer',
|
||||
:'int32' => :'Integer',
|
||||
:'int64' => :'Integer',
|
||||
:'number' => :'Float',
|
||||
:'float' => :'Float',
|
||||
:'double' => :'Float',
|
||||
:'string' => :'String',
|
||||
:'pattern_without_delimiter' => :'String',
|
||||
:'byte' => :'String',
|
||||
:'binary' => :'File',
|
||||
:'date' => :'Date',
|
||||
:'date_time' => :'Time',
|
||||
:'password' => :'String',
|
||||
:'callback' => :'String'
|
||||
}
|
||||
end
|
||||
|
||||
# List of attributes with nullable: true
|
||||
def self.openapi_nullable
|
||||
Set.new([
|
||||
])
|
||||
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::InlineObject3` initialize method"
|
||||
end
|
||||
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
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::InlineObject3`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.key?(:'integer')
|
||||
self.integer = attributes[:'integer']
|
||||
end
|
||||
|
||||
if attributes.key?(:'int32')
|
||||
self.int32 = attributes[:'int32']
|
||||
end
|
||||
|
||||
if attributes.key?(:'int64')
|
||||
self.int64 = attributes[:'int64']
|
||||
end
|
||||
|
||||
if attributes.key?(:'number')
|
||||
self.number = attributes[:'number']
|
||||
end
|
||||
|
||||
if attributes.key?(:'float')
|
||||
self.float = attributes[:'float']
|
||||
end
|
||||
|
||||
if attributes.key?(:'double')
|
||||
self.double = attributes[:'double']
|
||||
end
|
||||
|
||||
if attributes.key?(:'string')
|
||||
self.string = attributes[:'string']
|
||||
end
|
||||
|
||||
if attributes.key?(:'pattern_without_delimiter')
|
||||
self.pattern_without_delimiter = attributes[:'pattern_without_delimiter']
|
||||
end
|
||||
|
||||
if attributes.key?(:'byte')
|
||||
self.byte = attributes[:'byte']
|
||||
end
|
||||
|
||||
if attributes.key?(:'binary')
|
||||
self.binary = attributes[:'binary']
|
||||
end
|
||||
|
||||
if attributes.key?(:'date')
|
||||
self.date = attributes[:'date']
|
||||
end
|
||||
|
||||
if attributes.key?(:'date_time')
|
||||
self.date_time = attributes[:'date_time']
|
||||
end
|
||||
|
||||
if attributes.key?(:'password')
|
||||
self.password = attributes[:'password']
|
||||
end
|
||||
|
||||
if attributes.key?(:'callback')
|
||||
self.callback = attributes[:'callback']
|
||||
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
|
||||
invalid_properties = Array.new
|
||||
if !@integer.nil? && @integer > 100
|
||||
invalid_properties.push('invalid value for "integer", must be smaller than or equal to 100.')
|
||||
end
|
||||
|
||||
if !@integer.nil? && @integer < 10
|
||||
invalid_properties.push('invalid value for "integer", must be greater than or equal to 10.')
|
||||
end
|
||||
|
||||
if !@int32.nil? && @int32 > 200
|
||||
invalid_properties.push('invalid value for "int32", must be smaller than or equal to 200.')
|
||||
end
|
||||
|
||||
if !@int32.nil? && @int32 < 20
|
||||
invalid_properties.push('invalid value for "int32", must be greater than or equal to 20.')
|
||||
end
|
||||
|
||||
if @number.nil?
|
||||
invalid_properties.push('invalid value for "number", number cannot be nil.')
|
||||
end
|
||||
|
||||
if @number > 543.2
|
||||
invalid_properties.push('invalid value for "number", must be smaller than or equal to 543.2.')
|
||||
end
|
||||
|
||||
if @number < 32.1
|
||||
invalid_properties.push('invalid value for "number", must be greater than or equal to 32.1.')
|
||||
end
|
||||
|
||||
if !@float.nil? && @float > 987.6
|
||||
invalid_properties.push('invalid value for "float", must be smaller than or equal to 987.6.')
|
||||
end
|
||||
|
||||
if @double.nil?
|
||||
invalid_properties.push('invalid value for "double", double cannot be nil.')
|
||||
end
|
||||
|
||||
if @double > 123.4
|
||||
invalid_properties.push('invalid value for "double", must be smaller than or equal to 123.4.')
|
||||
end
|
||||
|
||||
if @double < 67.8
|
||||
invalid_properties.push('invalid value for "double", must be greater than or equal to 67.8.')
|
||||
end
|
||||
|
||||
pattern = Regexp.new(/[a-z]/i)
|
||||
if !@string.nil? && @string !~ pattern
|
||||
invalid_properties.push("invalid value for \"string\", must conform to the pattern #{pattern}.")
|
||||
end
|
||||
|
||||
if @pattern_without_delimiter.nil?
|
||||
invalid_properties.push('invalid value for "pattern_without_delimiter", pattern_without_delimiter cannot be nil.')
|
||||
end
|
||||
|
||||
pattern = Regexp.new(/^[A-Z].*/)
|
||||
if @pattern_without_delimiter !~ pattern
|
||||
invalid_properties.push("invalid value for \"pattern_without_delimiter\", must conform to the pattern #{pattern}.")
|
||||
end
|
||||
|
||||
if @byte.nil?
|
||||
invalid_properties.push('invalid value for "byte", byte cannot be nil.')
|
||||
end
|
||||
|
||||
if !@password.nil? && @password.to_s.length > 64
|
||||
invalid_properties.push('invalid value for "password", the character length must be smaller than or equal to 64.')
|
||||
end
|
||||
|
||||
if !@password.nil? && @password.to_s.length < 10
|
||||
invalid_properties.push('invalid value for "password", the character length must be great than or equal to 10.')
|
||||
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?
|
||||
return false if !@integer.nil? && @integer > 100
|
||||
return false if !@integer.nil? && @integer < 10
|
||||
return false if !@int32.nil? && @int32 > 200
|
||||
return false if !@int32.nil? && @int32 < 20
|
||||
return false if @number.nil?
|
||||
return false if @number > 543.2
|
||||
return false if @number < 32.1
|
||||
return false if !@float.nil? && @float > 987.6
|
||||
return false if @double.nil?
|
||||
return false if @double > 123.4
|
||||
return false if @double < 67.8
|
||||
return false if !@string.nil? && @string !~ Regexp.new(/[a-z]/i)
|
||||
return false if @pattern_without_delimiter.nil?
|
||||
return false if @pattern_without_delimiter !~ Regexp.new(/^[A-Z].*/)
|
||||
return false if @byte.nil?
|
||||
return false if !@password.nil? && @password.to_s.length > 64
|
||||
return false if !@password.nil? && @password.to_s.length < 10
|
||||
true
|
||||
end
|
||||
|
||||
# Custom attribute writer method with validation
|
||||
# @param [Object] integer Value to be assigned
|
||||
def integer=(integer)
|
||||
if !integer.nil? && integer > 100
|
||||
fail ArgumentError, 'invalid value for "integer", must be smaller than or equal to 100.'
|
||||
end
|
||||
|
||||
if !integer.nil? && integer < 10
|
||||
fail ArgumentError, 'invalid value for "integer", must be greater than or equal to 10.'
|
||||
end
|
||||
|
||||
@integer = integer
|
||||
end
|
||||
|
||||
# Custom attribute writer method with validation
|
||||
# @param [Object] int32 Value to be assigned
|
||||
def int32=(int32)
|
||||
if !int32.nil? && int32 > 200
|
||||
fail ArgumentError, 'invalid value for "int32", must be smaller than or equal to 200.'
|
||||
end
|
||||
|
||||
if !int32.nil? && int32 < 20
|
||||
fail ArgumentError, 'invalid value for "int32", must be greater than or equal to 20.'
|
||||
end
|
||||
|
||||
@int32 = int32
|
||||
end
|
||||
|
||||
# Custom attribute writer method with validation
|
||||
# @param [Object] number Value to be assigned
|
||||
def number=(number)
|
||||
if number.nil?
|
||||
fail ArgumentError, 'number cannot be nil'
|
||||
end
|
||||
|
||||
if number > 543.2
|
||||
fail ArgumentError, 'invalid value for "number", must be smaller than or equal to 543.2.'
|
||||
end
|
||||
|
||||
if number < 32.1
|
||||
fail ArgumentError, 'invalid value for "number", must be greater than or equal to 32.1.'
|
||||
end
|
||||
|
||||
@number = number
|
||||
end
|
||||
|
||||
# Custom attribute writer method with validation
|
||||
# @param [Object] float Value to be assigned
|
||||
def float=(float)
|
||||
if !float.nil? && float > 987.6
|
||||
fail ArgumentError, 'invalid value for "float", must be smaller than or equal to 987.6.'
|
||||
end
|
||||
|
||||
@float = float
|
||||
end
|
||||
|
||||
# Custom attribute writer method with validation
|
||||
# @param [Object] double Value to be assigned
|
||||
def double=(double)
|
||||
if double.nil?
|
||||
fail ArgumentError, 'double cannot be nil'
|
||||
end
|
||||
|
||||
if double > 123.4
|
||||
fail ArgumentError, 'invalid value for "double", must be smaller than or equal to 123.4.'
|
||||
end
|
||||
|
||||
if double < 67.8
|
||||
fail ArgumentError, 'invalid value for "double", must be greater than or equal to 67.8.'
|
||||
end
|
||||
|
||||
@double = double
|
||||
end
|
||||
|
||||
# Custom attribute writer method with validation
|
||||
# @param [Object] string Value to be assigned
|
||||
def string=(string)
|
||||
pattern = Regexp.new(/[a-z]/i)
|
||||
if !string.nil? && string !~ pattern
|
||||
fail ArgumentError, "invalid value for \"string\", must conform to the pattern #{pattern}."
|
||||
end
|
||||
|
||||
@string = string
|
||||
end
|
||||
|
||||
# Custom attribute writer method with validation
|
||||
# @param [Object] pattern_without_delimiter Value to be assigned
|
||||
def pattern_without_delimiter=(pattern_without_delimiter)
|
||||
if pattern_without_delimiter.nil?
|
||||
fail ArgumentError, 'pattern_without_delimiter cannot be nil'
|
||||
end
|
||||
|
||||
pattern = Regexp.new(/^[A-Z].*/)
|
||||
if pattern_without_delimiter !~ pattern
|
||||
fail ArgumentError, "invalid value for \"pattern_without_delimiter\", must conform to the pattern #{pattern}."
|
||||
end
|
||||
|
||||
@pattern_without_delimiter = pattern_without_delimiter
|
||||
end
|
||||
|
||||
# Custom attribute writer method with validation
|
||||
# @param [Object] password Value to be assigned
|
||||
def password=(password)
|
||||
if !password.nil? && password.to_s.length > 64
|
||||
fail ArgumentError, 'invalid value for "password", the character length must be smaller than or equal to 64.'
|
||||
end
|
||||
|
||||
if !password.nil? && password.to_s.length < 10
|
||||
fail ArgumentError, 'invalid value for "password", the character length must be great than or equal to 10.'
|
||||
end
|
||||
|
||||
@password = password
|
||||
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 &&
|
||||
integer == o.integer &&
|
||||
int32 == o.int32 &&
|
||||
int64 == o.int64 &&
|
||||
number == o.number &&
|
||||
float == o.float &&
|
||||
double == o.double &&
|
||||
string == o.string &&
|
||||
pattern_without_delimiter == o.pattern_without_delimiter &&
|
||||
byte == o.byte &&
|
||||
binary == o.binary &&
|
||||
date == o.date &&
|
||||
date_time == o.date_time &&
|
||||
password == o.password &&
|
||||
callback == o.callback
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
# @param [Object] Object to be compared
|
||||
def eql?(o)
|
||||
self == o
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[integer, int32, int64, number, float, double, string, pattern_without_delimiter, byte, binary, date, date_time, password, callback].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)
|
||||
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)
|
||||
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) })
|
||||
end
|
||||
elsif !attributes[self.class.attribute_map[key]].nil?
|
||||
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
||||
end
|
||||
end
|
||||
|
||||
self
|
||||
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)
|
||||
case type.to_sym
|
||||
when :Time
|
||||
Time.parse(value)
|
||||
when :Date
|
||||
Date.parse(value)
|
||||
when :String
|
||||
value.to_s
|
||||
when :Integer
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
when :Object
|
||||
# generic object (usually a Hash), return directly
|
||||
value
|
||||
when /\AArray<(?<inner_type>.+)>\z/
|
||||
inner_type = Regexp.last_match[:inner_type]
|
||||
value.map { |v| _deserialize(inner_type, v) }
|
||||
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
||||
k_type = Regexp.last_match[:k_type]
|
||||
v_type = Regexp.last_match[:v_type]
|
||||
{}.tap do |hash|
|
||||
value.each do |k, v|
|
||||
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
||||
end
|
||||
end
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
||||
# Returns the string representation of the object
|
||||
# @return [String] String presentation of the object
|
||||
def to_s
|
||||
to_hash.to_s
|
||||
end
|
||||
|
||||
# to_body is an alias to to_hash (backward compatibility)
|
||||
# @return [Hash] Returns the object in the form of hash
|
||||
def to_body
|
||||
to_hash
|
||||
end
|
||||
|
||||
# Returns the object in the form of hash
|
||||
# @return [Hash] Returns the object in the form of hash
|
||||
def to_hash
|
||||
hash = {}
|
||||
self.class.attribute_map.each_pair do |attr, param|
|
||||
value = self.send(attr)
|
||||
if value.nil?
|
||||
is_nullable = self.class.openapi_nullable.include?(attr)
|
||||
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
||||
end
|
||||
|
||||
hash[param] = _to_hash(value)
|
||||
end
|
||||
hash
|
||||
end
|
||||
|
||||
# Outputs non-array value in the form of hash
|
||||
# For object, use to_hash. Otherwise, just return the value
|
||||
# @param [Object] value Any valid value
|
||||
# @return [Hash] Returns the value in the form of hash
|
||||
def _to_hash(value)
|
||||
if value.is_a?(Array)
|
||||
value.compact.map { |v| _to_hash(v) }
|
||||
elsif value.is_a?(Hash)
|
||||
{}.tap do |hash|
|
||||
value.each { |k, v| hash[k] = _to_hash(v) }
|
||||
end
|
||||
elsif value.respond_to? :to_hash
|
||||
value.to_hash
|
||||
else
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,239 @@
|
||||
=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
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
require 'time'
|
||||
|
||||
module Petstore
|
||||
class InlineObject4
|
||||
# field1
|
||||
attr_accessor :param
|
||||
|
||||
# field2
|
||||
attr_accessor :param2
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
:'param' => :'param',
|
||||
:'param2' => :'param2'
|
||||
}
|
||||
end
|
||||
|
||||
# Returns all the JSON keys this model knows about
|
||||
def self.acceptable_attributes
|
||||
attribute_map.values
|
||||
end
|
||||
|
||||
# Attribute type mapping.
|
||||
def self.openapi_types
|
||||
{
|
||||
:'param' => :'String',
|
||||
:'param2' => :'String'
|
||||
}
|
||||
end
|
||||
|
||||
# List of attributes with nullable: true
|
||||
def self.openapi_nullable
|
||||
Set.new([
|
||||
])
|
||||
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::InlineObject4` initialize method"
|
||||
end
|
||||
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
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::InlineObject4`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.key?(:'param')
|
||||
self.param = attributes[:'param']
|
||||
end
|
||||
|
||||
if attributes.key?(:'param2')
|
||||
self.param2 = attributes[:'param2']
|
||||
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
|
||||
invalid_properties = Array.new
|
||||
if @param.nil?
|
||||
invalid_properties.push('invalid value for "param", param cannot be nil.')
|
||||
end
|
||||
|
||||
if @param2.nil?
|
||||
invalid_properties.push('invalid value for "param2", param2 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?
|
||||
return false if @param.nil?
|
||||
return false if @param2.nil?
|
||||
true
|
||||
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 &&
|
||||
param == o.param &&
|
||||
param2 == o.param2
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
# @param [Object] Object to be compared
|
||||
def eql?(o)
|
||||
self == o
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[param, param2].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)
|
||||
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)
|
||||
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) })
|
||||
end
|
||||
elsif !attributes[self.class.attribute_map[key]].nil?
|
||||
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
||||
end
|
||||
end
|
||||
|
||||
self
|
||||
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)
|
||||
case type.to_sym
|
||||
when :Time
|
||||
Time.parse(value)
|
||||
when :Date
|
||||
Date.parse(value)
|
||||
when :String
|
||||
value.to_s
|
||||
when :Integer
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
when :Object
|
||||
# generic object (usually a Hash), return directly
|
||||
value
|
||||
when /\AArray<(?<inner_type>.+)>\z/
|
||||
inner_type = Regexp.last_match[:inner_type]
|
||||
value.map { |v| _deserialize(inner_type, v) }
|
||||
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
||||
k_type = Regexp.last_match[:k_type]
|
||||
v_type = Regexp.last_match[:v_type]
|
||||
{}.tap do |hash|
|
||||
value.each do |k, v|
|
||||
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
||||
end
|
||||
end
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
||||
# Returns the string representation of the object
|
||||
# @return [String] String presentation of the object
|
||||
def to_s
|
||||
to_hash.to_s
|
||||
end
|
||||
|
||||
# to_body is an alias to to_hash (backward compatibility)
|
||||
# @return [Hash] Returns the object in the form of hash
|
||||
def to_body
|
||||
to_hash
|
||||
end
|
||||
|
||||
# Returns the object in the form of hash
|
||||
# @return [Hash] Returns the object in the form of hash
|
||||
def to_hash
|
||||
hash = {}
|
||||
self.class.attribute_map.each_pair do |attr, param|
|
||||
value = self.send(attr)
|
||||
if value.nil?
|
||||
is_nullable = self.class.openapi_nullable.include?(attr)
|
||||
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
||||
end
|
||||
|
||||
hash[param] = _to_hash(value)
|
||||
end
|
||||
hash
|
||||
end
|
||||
|
||||
# Outputs non-array value in the form of hash
|
||||
# For object, use to_hash. Otherwise, just return the value
|
||||
# @param [Object] value Any valid value
|
||||
# @return [Hash] Returns the value in the form of hash
|
||||
def _to_hash(value)
|
||||
if value.is_a?(Array)
|
||||
value.compact.map { |v| _to_hash(v) }
|
||||
elsif value.is_a?(Hash)
|
||||
{}.tap do |hash|
|
||||
value.each { |k, v| hash[k] = _to_hash(v) }
|
||||
end
|
||||
elsif value.respond_to? :to_hash
|
||||
value.to_hash
|
||||
else
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,234 @@
|
||||
=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
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
require 'time'
|
||||
|
||||
module Petstore
|
||||
class InlineObject5
|
||||
# Additional data to pass to server
|
||||
attr_accessor :additional_metadata
|
||||
|
||||
# file to upload
|
||||
attr_accessor :required_file
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
:'additional_metadata' => :'additionalMetadata',
|
||||
:'required_file' => :'requiredFile'
|
||||
}
|
||||
end
|
||||
|
||||
# Returns all the JSON keys this model knows about
|
||||
def self.acceptable_attributes
|
||||
attribute_map.values
|
||||
end
|
||||
|
||||
# Attribute type mapping.
|
||||
def self.openapi_types
|
||||
{
|
||||
:'additional_metadata' => :'String',
|
||||
:'required_file' => :'File'
|
||||
}
|
||||
end
|
||||
|
||||
# List of attributes with nullable: true
|
||||
def self.openapi_nullable
|
||||
Set.new([
|
||||
])
|
||||
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::InlineObject5` initialize method"
|
||||
end
|
||||
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
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::InlineObject5`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.key?(:'additional_metadata')
|
||||
self.additional_metadata = attributes[:'additional_metadata']
|
||||
end
|
||||
|
||||
if attributes.key?(:'required_file')
|
||||
self.required_file = attributes[:'required_file']
|
||||
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
|
||||
invalid_properties = Array.new
|
||||
if @required_file.nil?
|
||||
invalid_properties.push('invalid value for "required_file", required_file 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?
|
||||
return false if @required_file.nil?
|
||||
true
|
||||
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 &&
|
||||
additional_metadata == o.additional_metadata &&
|
||||
required_file == o.required_file
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
# @param [Object] Object to be compared
|
||||
def eql?(o)
|
||||
self == o
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[additional_metadata, required_file].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)
|
||||
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)
|
||||
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) })
|
||||
end
|
||||
elsif !attributes[self.class.attribute_map[key]].nil?
|
||||
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
||||
end
|
||||
end
|
||||
|
||||
self
|
||||
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)
|
||||
case type.to_sym
|
||||
when :Time
|
||||
Time.parse(value)
|
||||
when :Date
|
||||
Date.parse(value)
|
||||
when :String
|
||||
value.to_s
|
||||
when :Integer
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
when :Object
|
||||
# generic object (usually a Hash), return directly
|
||||
value
|
||||
when /\AArray<(?<inner_type>.+)>\z/
|
||||
inner_type = Regexp.last_match[:inner_type]
|
||||
value.map { |v| _deserialize(inner_type, v) }
|
||||
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
||||
k_type = Regexp.last_match[:k_type]
|
||||
v_type = Regexp.last_match[:v_type]
|
||||
{}.tap do |hash|
|
||||
value.each do |k, v|
|
||||
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
||||
end
|
||||
end
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
||||
# Returns the string representation of the object
|
||||
# @return [String] String presentation of the object
|
||||
def to_s
|
||||
to_hash.to_s
|
||||
end
|
||||
|
||||
# to_body is an alias to to_hash (backward compatibility)
|
||||
# @return [Hash] Returns the object in the form of hash
|
||||
def to_body
|
||||
to_hash
|
||||
end
|
||||
|
||||
# Returns the object in the form of hash
|
||||
# @return [Hash] Returns the object in the form of hash
|
||||
def to_hash
|
||||
hash = {}
|
||||
self.class.attribute_map.each_pair do |attr, param|
|
||||
value = self.send(attr)
|
||||
if value.nil?
|
||||
is_nullable = self.class.openapi_nullable.include?(attr)
|
||||
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
||||
end
|
||||
|
||||
hash[param] = _to_hash(value)
|
||||
end
|
||||
hash
|
||||
end
|
||||
|
||||
# Outputs non-array value in the form of hash
|
||||
# For object, use to_hash. Otherwise, just return the value
|
||||
# @param [Object] value Any valid value
|
||||
# @return [Hash] Returns the value in the form of hash
|
||||
def _to_hash(value)
|
||||
if value.is_a?(Array)
|
||||
value.compact.map { |v| _to_hash(v) }
|
||||
elsif value.is_a?(Hash)
|
||||
{}.tap do |hash|
|
||||
value.each { |k, v| hash[k] = _to_hash(v) }
|
||||
end
|
||||
elsif value.respond_to? :to_hash
|
||||
value.to_hash
|
||||
else
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,219 @@
|
||||
=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
|
||||
OpenAPI Generator version: 6.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
require 'time'
|
||||
|
||||
module Petstore
|
||||
class InlineResponseDefault
|
||||
attr_accessor :string
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
:'string' => :'string'
|
||||
}
|
||||
end
|
||||
|
||||
# Returns all the JSON keys this model knows about
|
||||
def self.acceptable_attributes
|
||||
attribute_map.values
|
||||
end
|
||||
|
||||
# Attribute type mapping.
|
||||
def self.openapi_types
|
||||
{
|
||||
:'string' => :'Foo'
|
||||
}
|
||||
end
|
||||
|
||||
# List of attributes with nullable: true
|
||||
def self.openapi_nullable
|
||||
Set.new([
|
||||
])
|
||||
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::InlineResponseDefault` initialize method"
|
||||
end
|
||||
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
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
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.key?(:'string')
|
||||
self.string = attributes[:'string']
|
||||
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
|
||||
invalid_properties = Array.new
|
||||
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?
|
||||
true
|
||||
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
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
# @param [Object] Object to be compared
|
||||
def eql?(o)
|
||||
self == o
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[string].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)
|
||||
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) })
|
||||
end
|
||||
elsif !attributes[self.class.attribute_map[key]].nil?
|
||||
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
||||
end
|
||||
end
|
||||
|
||||
self
|
||||
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)
|
||||
case type.to_sym
|
||||
when :Time
|
||||
Time.parse(value)
|
||||
when :Date
|
||||
Date.parse(value)
|
||||
when :String
|
||||
value.to_s
|
||||
when :Integer
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
when :Object
|
||||
# generic object (usually a Hash), return directly
|
||||
value
|
||||
when /\AArray<(?<inner_type>.+)>\z/
|
||||
inner_type = Regexp.last_match[:inner_type]
|
||||
value.map { |v| _deserialize(inner_type, v) }
|
||||
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
||||
k_type = Regexp.last_match[:k_type]
|
||||
v_type = Regexp.last_match[:v_type]
|
||||
{}.tap do |hash|
|
||||
value.each do |k, v|
|
||||
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
||||
end
|
||||
end
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
||||
# Returns the string representation of the object
|
||||
# @return [String] String presentation of the object
|
||||
def to_s
|
||||
to_hash.to_s
|
||||
end
|
||||
|
||||
# to_body is an alias to to_hash (backward compatibility)
|
||||
# @return [Hash] Returns the object in the form of hash
|
||||
def to_body
|
||||
to_hash
|
||||
end
|
||||
|
||||
# Returns the object in the form of hash
|
||||
# @return [Hash] Returns the object in the form of hash
|
||||
def to_hash
|
||||
hash = {}
|
||||
self.class.attribute_map.each_pair do |attr, param|
|
||||
value = self.send(attr)
|
||||
if value.nil?
|
||||
is_nullable = self.class.openapi_nullable.include?(attr)
|
||||
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
||||
end
|
||||
|
||||
hash[param] = _to_hash(value)
|
||||
end
|
||||
hash
|
||||
end
|
||||
|
||||
# Outputs non-array value in the form of hash
|
||||
# For object, use to_hash. Otherwise, just return the value
|
||||
# @param [Object] value Any valid value
|
||||
# @return [Hash] Returns the value in the form of hash
|
||||
def _to_hash(value)
|
||||
if value.is_a?(Array)
|
||||
value.compact.map { |v| _to_hash(v) }
|
||||
elsif value.is_a?(Hash)
|
||||
{}.tap do |hash|
|
||||
value.each { |k, v| hash[k] = _to_hash(v) }
|
||||
end
|
||||
elsif value.respond_to? :to_hash
|
||||
value.to_hash
|
||||
else
|
||||
value
|
||||
end
|
||||
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
|
||||
OpenAPI Generator version: 7.1.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,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
|
||||
OpenAPI Generator version: 7.1.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"
|
||||
typed_data = find_and_cast_into_type(klass, data)
|
||||
return typed_data if typed_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.parse(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 unless (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,105 @@
|
||||
=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
|
||||
OpenAPI Generator version: 7.1.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"
|
||||
typed_data = find_and_cast_into_type(klass, data)
|
||||
return typed_data if typed_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.parse(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 unless (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,47 +14,37 @@ 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 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
|
||||
attribute_map.values.concat(superclass.acceptable_attributes)
|
||||
attribute_map.values
|
||||
end
|
||||
|
||||
# Attribute type mapping.
|
||||
def self.openapi_types
|
||||
{
|
||||
:'other_property' => :'String'
|
||||
:'http_debug_operation' => :'String',
|
||||
:'_type' => :'String',
|
||||
:'type' => :'String',
|
||||
:'type_' => :'String'
|
||||
}
|
||||
end
|
||||
|
||||
@ -64,33 +54,35 @@ 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
|
||||
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::ChildWithNullable`. Please check the name to make sure it's valid. List of attributes: " + self.class.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: " + self.class.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
|
||||
|
||||
@ -98,7 +90,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
|
||||
|
||||
@ -106,7 +98,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.
|
||||
@ -114,7 +106,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
|
||||
@ -126,7 +121,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
|
||||
@ -134,7 +129,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|
|
||||
@ -211,7 +205,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?
|
239
samples/client/petstore/ruby-httpx/lib/petstore/models/whale.rb
Normal file
239
samples/client/petstore/ruby-httpx/lib/petstore/models/whale.rb
Normal file
@ -0,0 +1,239 @@
|
||||
=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
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
require 'time'
|
||||
|
||||
module Petstore
|
||||
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
|
||||
{
|
||||
:'has_baleen' => :'hasBaleen',
|
||||
:'has_teeth' => :'hasTeeth',
|
||||
:'classname' => :'classname'
|
||||
}
|
||||
end
|
||||
|
||||
# Returns all the JSON keys this model knows about
|
||||
def self.acceptable_attributes
|
||||
attribute_map.values
|
||||
end
|
||||
|
||||
# Attribute type mapping.
|
||||
def self.openapi_types
|
||||
{
|
||||
:'has_baleen' => :'Boolean',
|
||||
:'has_teeth' => :'Boolean',
|
||||
:'classname' => :'String'
|
||||
}
|
||||
end
|
||||
|
||||
# List of attributes with nullable: true
|
||||
def self.openapi_nullable
|
||||
Set.new([
|
||||
])
|
||||
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::Whale` initialize method"
|
||||
end
|
||||
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
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::Whale`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
# Checks equality by comparing each attribute.
|
||||
# @param [Object] Object to be compared
|
||||
def ==(o)
|
||||
return true if self.equal?(o)
|
||||
self.class == o.class &&
|
||||
has_baleen == o.has_baleen &&
|
||||
has_teeth == o.has_teeth &&
|
||||
classname == o.classname
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
# @param [Object] Object to be compared
|
||||
def eql?(o)
|
||||
self == o
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Integer] Hash code
|
||||
def 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)
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
attributes = attributes.transform_keys(&:to_sym)
|
||||
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[attribute_map[key]].is_a?(Array)
|
||||
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
||||
end
|
||||
elsif !attributes[attribute_map[key]].nil?
|
||||
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
||||
end
|
||||
end
|
||||
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 self._deserialize(type, value)
|
||||
case type.to_sym
|
||||
when :Time
|
||||
Time.parse(value)
|
||||
when :Date
|
||||
Date.parse(value)
|
||||
when :String
|
||||
value.to_s
|
||||
when :Integer
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
when :Object
|
||||
# generic object (usually a Hash), return directly
|
||||
value
|
||||
when /\AArray<(?<inner_type>.+)>\z/
|
||||
inner_type = Regexp.last_match[:inner_type]
|
||||
value.map { |v| _deserialize(inner_type, v) }
|
||||
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
||||
k_type = Regexp.last_match[:k_type]
|
||||
v_type = Regexp.last_match[:v_type]
|
||||
{}.tap do |hash|
|
||||
value.each do |k, v|
|
||||
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
||||
end
|
||||
end
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
||||
# Returns the string representation of the object
|
||||
# @return [String] String presentation of the object
|
||||
def to_s
|
||||
to_hash.to_s
|
||||
end
|
||||
|
||||
# to_body is an alias to to_hash (backward compatibility)
|
||||
# @return [Hash] Returns the object in the form of hash
|
||||
def to_body
|
||||
to_hash
|
||||
end
|
||||
|
||||
# Returns the object in the form of hash
|
||||
# @return [Hash] Returns the object in the form of hash
|
||||
def to_hash
|
||||
hash = {}
|
||||
self.class.attribute_map.each_pair do |attr, param|
|
||||
value = self.send(attr)
|
||||
if value.nil?
|
||||
is_nullable = self.class.openapi_nullable.include?(attr)
|
||||
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
||||
end
|
||||
|
||||
hash[param] = _to_hash(value)
|
||||
end
|
||||
hash
|
||||
end
|
||||
|
||||
# Outputs non-array value in the form of hash
|
||||
# For object, use to_hash. Otherwise, just return the value
|
||||
# @param [Object] value Any valid value
|
||||
# @return [Hash] Returns the value in the form of hash
|
||||
def _to_hash(value)
|
||||
if value.is_a?(Array)
|
||||
value.compact.map { |v| _to_hash(v) }
|
||||
elsif value.is_a?(Hash)
|
||||
{}.tap do |hash|
|
||||
value.each { |k, v| hash[k] = _to_hash(v) }
|
||||
end
|
||||
elsif value.respond_to? :to_hash
|
||||
value.to_hash
|
||||
else
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
@ -58,33 +58,27 @@ 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
|
||||
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::ParentWithNullable`. Please check the name to make sure it's valid. List of attributes: " + self.class.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: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
@ -93,8 +87,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
|
||||
|
||||
@ -103,6 +99,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
|
||||
|
||||
@ -110,15 +110,16 @@ 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
|
||||
@ -131,7 +132,7 @@ module Petstore
|
||||
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
|
||||
@ -143,7 +144,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
|
315
samples/client/petstore/ruby-httpx/petstore_profiling.output
Normal file
315
samples/client/petstore/ruby-httpx/petstore_profiling.output
Normal file
@ -0,0 +1,315 @@
|
||||
Measure Mode: wall_time
|
||||
Thread ID: 70329221636600
|
||||
Fiber ID: 70329234076680
|
||||
Total: 10.998497
|
||||
Sort by: self_time
|
||||
|
||||
%self total self wait child calls name
|
||||
99.20 10.920 10.911 0.000 0.010 20 <Module::Ethon::Curl>#easy_perform
|
||||
0.05 0.005 0.005 0.000 0.000 1392 Symbol#to_s
|
||||
0.04 0.019 0.005 0.000 0.015 268 Ethon::Curls::Options#set_option
|
||||
0.02 0.003 0.003 0.000 0.000 718 Ethon::Easy::Operations#handle
|
||||
0.02 0.003 0.003 0.000 0.000 657 String#downcase
|
||||
0.02 0.003 0.003 0.000 0.000 658 FFI::Enum#to_native
|
||||
0.02 0.003 0.003 0.000 0.000 678 FFI::Enum#from_native
|
||||
0.02 0.029 0.002 0.000 0.027 200 *Proc#call
|
||||
0.02 0.034 0.002 0.000 0.032 210 *Array#each
|
||||
0.02 0.014 0.002 0.000 0.012 309 *Class#new
|
||||
0.02 0.004 0.002 0.000 0.003 390 <Module::Ethon::Curl>#easy_getinfo
|
||||
0.02 0.002 0.002 0.000 0.000 175 Typhoeus::EasyFactory#renamed_options
|
||||
0.01 0.001 0.001 0.000 0.000 744 Kernel#respond_to?
|
||||
0.01 0.003 0.001 0.000 0.002 201 *<Class::Petstore::Configuration>#method_missing
|
||||
0.01 0.006 0.001 0.000 0.005 75 Hash#each
|
||||
0.01 0.020 0.001 0.000 0.019 56 *Hash#each_pair
|
||||
0.01 0.001 0.001 0.000 0.000 430 Symbol#to_sym
|
||||
0.01 0.004 0.001 0.000 0.003 210 Ethon::Curls::Infos#get_info_double
|
||||
0.01 0.003 0.001 0.000 0.002 175 *Array#map
|
||||
0.01 0.001 0.001 0.000 0.000 268 Ethon::Curls::Options#easy_options
|
||||
0.01 0.001 0.001 0.000 0.000 201 <Class::Petstore::Configuration>#instance
|
||||
0.01 0.001 0.001 0.000 0.000 420 Ethon::Curls::Infos#double_ptr
|
||||
0.01 0.002 0.001 0.000 0.001 250 FFI::Pointer#read_string
|
||||
0.01 0.001 0.001 0.000 0.000 80 Hash#initialize_copy
|
||||
0.01 0.001 0.001 0.000 0.000 240 Typhoeus::Response::Header#set_value
|
||||
0.01 0.001 0.001 0.000 0.000 656 Kernel#is_a?
|
||||
0.01 0.001 0.001 0.000 0.000 42 String#gsub
|
||||
0.01 0.003 0.001 0.000 0.002 120 Ethon::Curls::Infos#get_info_long
|
||||
0.01 0.004 0.001 0.000 0.004 120 Typhoeus::Response::Header#process_line
|
||||
0.01 0.001 0.001 0.000 0.001 85 <Module::Ethon::Curl>#easy_setopt_string
|
||||
0.01 0.001 0.001 0.000 0.000 140 String#split
|
||||
0.01 0.001 0.001 0.000 0.000 485 Kernel#nil?
|
||||
0.01 0.001 0.001 0.000 0.000 240 Ethon::Curls::Infos#long_ptr
|
||||
0.01 0.001 0.001 0.000 0.000 42 <Module::Ethon::Curl>#easy_setopt_callback
|
||||
0.01 0.006 0.001 0.000 0.006 20 Petstore::ApiClient#build_request
|
||||
0.00 0.001 0.000 0.000 0.001 90 <Module::Ethon::Curl>#easy_setopt_long
|
||||
0.00 0.000 0.000 0.000 0.000 170 FFI::AbstractMemory#get_bytes
|
||||
0.00 0.001 0.000 0.000 0.000 30 <Class::Ethon::Easy::Mirror>#informations_to_mirror
|
||||
0.00 0.002 0.000 0.000 0.002 120 Typhoeus::Response::Header#process_pair
|
||||
0.00 0.002 0.000 0.000 0.002 60 Ethon::Curls::Infos#get_info_string
|
||||
0.00 0.000 0.000 0.000 0.000 190 String#to_s
|
||||
0.00 0.000 0.000 0.000 0.000 130 Kernel#class
|
||||
0.00 0.000 0.000 0.000 0.000 240 String#strip
|
||||
0.00 0.001 0.000 0.000 0.001 42 Mutex#synchronize
|
||||
0.00 0.000 0.000 0.000 0.000 268 Hash#include?
|
||||
0.00 0.000 0.000 0.000 0.000 36 String#sub
|
||||
0.00 0.001 0.000 0.000 0.001 21 FFI::AutoPointer#initialize
|
||||
0.00 0.000 0.000 0.000 0.000 400 Array#include?
|
||||
0.00 10.941 0.000 0.000 10.941 20 Ethon::Easy::Operations#perform
|
||||
0.00 0.000 0.000 0.000 0.000 185 Integer#to_i
|
||||
0.00 0.006 0.000 0.000 0.006 21 Ethon::Easy::Callbacks#set_callbacks
|
||||
0.00 0.001 0.000 0.000 0.001 80 Ethon::Easy::Header#compose_header
|
||||
0.00 0.000 0.000 0.000 0.000 210 FFI::AbstractMemory#read_double
|
||||
0.00 0.001 0.000 0.000 0.000 90 <Module::FFI>#find_type
|
||||
0.00 0.001 0.000 0.000 0.001 90 <Module::FFI>#type_size
|
||||
0.00 0.002 0.000 0.000 0.001 30 Ethon::Easy::Informations#httpauth_avail
|
||||
0.00 0.000 0.000 0.000 0.000 80 <Module::Ethon::Curl>#slist_append
|
||||
0.00 0.001 0.000 0.000 0.001 85 Kernel#initialize_dup
|
||||
0.00 0.000 0.000 0.000 0.000 330 Hash#has_key?
|
||||
0.00 10.993 0.000 0.000 10.992 20 Petstore::ApiClient#call_api
|
||||
0.00 0.000 0.000 0.000 0.000 80 String#encode
|
||||
0.00 0.001 0.000 0.000 0.000 20 Petstore::Configuration#auth_settings
|
||||
0.00 0.001 0.000 0.000 0.000 140 Typhoeus::Response::Informations#response_code
|
||||
0.00 0.000 0.000 0.000 0.000 65 <Class::Petstore::Pet>#attribute_map
|
||||
0.00 0.000 0.000 0.000 0.000 35 Petstore::ApiClient#json_mime?
|
||||
0.00 0.001 0.000 0.000 0.000 85 Ethon::Easy::Http::Actionable#form
|
||||
0.00 0.000 0.000 0.000 0.000 45 Hash#keys
|
||||
0.00 0.023 0.000 0.000 0.022 20 Ethon::Easy::Http::Actionable#setup
|
||||
0.00 0.002 0.000 0.000 0.001 80 Typhoeus::EasyFactory#easy
|
||||
0.00 0.001 0.000 0.000 0.001 20 Typhoeus::Request::Callbacks#execute_callbacks
|
||||
0.00 0.001 0.000 0.000 0.000 40 Hash#merge
|
||||
0.00 0.001 0.000 0.000 0.000 80 Ethon::Easy::Util#escape_zero_byte
|
||||
0.00 0.000 0.000 0.000 0.000 120 Ethon::Curls::Infos#string_ptr
|
||||
0.00 0.001 0.000 0.000 0.000 50 Enumerable#find
|
||||
0.00 0.000 0.000 0.000 0.000 80 FFI::AbstractMemory#get_string
|
||||
0.00 0.000 0.000 0.000 0.000 80 Typhoeus::Request::Responseable#response
|
||||
0.00 0.000 0.000 0.000 0.000 120 FFI::AbstractMemory#read_long
|
||||
0.00 0.000 0.000 0.000 0.000 120 Hash#[]=
|
||||
0.00 0.001 0.000 0.000 0.001 40 Typhoeus::Response::Status#success?
|
||||
0.00 10.998 0.000 0.000 10.998 5 PetstoreProfiling#call_apis
|
||||
0.00 0.000 0.000 0.000 0.000 20 <Module::Ethon::Curl>#easy_reset
|
||||
0.00 0.007 0.000 0.000 0.007 25 Typhoeus::Response::Informations#headers
|
||||
0.00 0.000 0.000 0.000 0.000 90 Fixnum#<<
|
||||
0.00 0.001 0.000 0.000 0.001 20 Petstore::ApiClient#build_request_url
|
||||
0.00 0.032 0.000 0.000 0.031 20 Typhoeus::EasyFactory#get
|
||||
0.00 0.001 0.000 0.000 0.001 45 Kernel#dup
|
||||
0.00 0.000 0.000 0.000 0.000 21 <Module::Ethon::Curl>#easy_setopt_debug_callback
|
||||
0.00 0.016 0.000 0.000 0.016 30 <Class::Ethon::Easy::Mirror>#from_easy
|
||||
0.00 0.000 0.000 0.000 0.000 20 String#lines
|
||||
0.00 0.001 0.000 0.000 0.000 20 Typhoeus::Request#set_defaults
|
||||
0.00 0.006 0.000 0.000 0.006 20 Typhoeus::Response::Header#initialize
|
||||
0.00 0.000 0.000 0.000 0.000 40 Typhoeus::Request::Callbacks::Types#on_complete
|
||||
0.00 0.000 0.000 0.000 0.000 120 Symbol#to_proc
|
||||
0.00 0.001 0.000 0.000 0.000 20 Typhoeus::EasyFactory#set_callback
|
||||
0.00 10.974 0.000 0.000 10.973 20 Typhoeus::Request::Operations#run
|
||||
0.00 0.001 0.000 0.000 0.001 60 *Petstore::BaseObject#_to_hash
|
||||
0.00 0.000 0.000 0.000 0.000 90 FFI::Type#size
|
||||
0.00 0.000 0.000 0.000 0.000 60 FFI::AbstractMemory#read_pointer
|
||||
0.00 0.002 0.000 0.000 0.002 20 Typhoeus::Request::Operations#finish
|
||||
0.00 0.001 0.000 0.000 0.000 21 URI::Escape#escape
|
||||
0.00 0.000 0.000 0.000 0.000 40 Typhoeus::Request::Callbacks::Types#on_success
|
||||
0.00 0.000 0.000 0.000 0.000 22 Ethon::Loggable#logger
|
||||
0.00 0.000 0.000 0.000 0.000 65 Typhoeus::Response#mock
|
||||
0.00 0.006 0.000 0.000 0.006 20 Ethon::Easy#reset
|
||||
0.00 0.001 0.000 0.000 0.000 30 <Module::Ethon::Curl>#easy_setopt_ffipointer
|
||||
0.00 0.001 0.000 0.000 0.001 5 JSON::Ext::Generator::GeneratorMethods::Hash#to_json
|
||||
0.00 3.494 0.000 0.000 3.494 5 Petstore::PetApi#get_pet_by_id_with_http_info
|
||||
0.00 0.000 0.000 0.000 0.000 160 Kernel#block_given?
|
||||
0.00 3.220 0.000 0.000 3.219 5 Petstore::PetApi#update_pet_with_form_with_http_info
|
||||
0.00 0.001 0.000 0.000 0.001 30 Ethon::Easy::Informations#effective_url
|
||||
0.00 0.006 0.000 0.000 0.006 20 Typhoeus::Response::Header#parse
|
||||
0.00 10.975 0.000 0.000 10.975 20 Typhoeus::Request::Before#run
|
||||
0.00 0.011 0.000 0.000 0.011 20 Ethon::Easy#mirror
|
||||
0.00 0.000 0.000 0.000 0.000 40 <Module::Typhoeus::Pool>#easies
|
||||
0.00 0.000 0.000 0.000 0.000 40 Typhoeus::EasyFactory#sanitize_timeout!
|
||||
0.00 0.000 0.000 0.000 0.000 5 JSON::Ext::Parser#parse
|
||||
0.00 0.000 0.000 0.000 0.000 50 String#to_sym
|
||||
0.00 0.000 0.000 0.000 0.000 70 Hash#fetch
|
||||
0.00 0.001 0.000 0.000 0.001 20 Typhoeus::Request#initialize
|
||||
0.00 0.005 0.000 0.000 0.005 20 Typhoeus::EasyFactory#sanitize
|
||||
0.00 0.000 0.000 0.000 0.000 21 URI::RFC2396_Parser#escape
|
||||
0.00 0.001 0.000 0.000 0.001 30 Ethon::Easy::Informations#total_time
|
||||
0.00 0.001 0.000 0.000 0.001 30 Ethon::Easy::Informations#appconnect_time
|
||||
0.00 2.141 0.000 0.000 2.141 5 Petstore::PetApi#delete_pet_with_http_info
|
||||
0.00 0.001 0.000 0.000 0.000 20 Petstore::ApiClient#select_header_accept
|
||||
0.00 0.000 0.000 0.000 0.000 30 Enumerable#inject
|
||||
0.00 0.000 0.000 0.000 0.000 80 Integer#chr
|
||||
0.00 0.000 0.000 0.000 0.000 90 Fixnum#<
|
||||
0.00 10.974 0.000 0.000 10.974 20 Typhoeus::Request::BlockConnection#run
|
||||
0.00 2.143 0.000 0.000 2.143 5 Petstore::PetApi#add_pet_with_http_info
|
||||
0.00 0.000 0.000 0.000 0.000 21 Logger#add
|
||||
0.00 0.020 0.000 0.000 0.020 20 Ethon::Easy::ResponseCallbacks#complete
|
||||
0.00 0.000 0.000 0.000 0.000 21 Logger#debug
|
||||
0.00 10.975 0.000 0.000 10.974 20 Typhoeus::Request::Stubbable#run
|
||||
0.00 0.004 0.000 0.000 0.004 20 Ethon::Easy::Header#headers=
|
||||
0.00 0.000 0.000 0.000 0.000 20 Typhoeus::Request::Cacheable#response=
|
||||
0.00 0.001 0.000 0.000 0.001 50 *Petstore::BaseObject#_deserialize
|
||||
0.00 0.000 0.000 0.000 0.000 35 Module#const_get
|
||||
0.00 0.000 0.000 0.000 0.000 20 Ethon::Easy::Http::Actionable#params
|
||||
0.00 0.003 0.000 0.000 0.003 10 Ethon::Easy::Http::Postable#set_form
|
||||
0.00 0.000 0.000 0.000 0.000 50 Symbol#=~
|
||||
0.00 0.001 0.000 0.000 0.001 30 Ethon::Easy::Informations#pretransfer_time
|
||||
0.00 0.000 0.000 0.000 0.000 30 Typhoeus::Response#initialize
|
||||
0.00 0.000 0.000 0.000 0.000 10 Petstore::Pet#initialize
|
||||
0.00 0.000 0.000 0.000 0.000 20 Petstore::ApiClient#select_header_content_type
|
||||
0.00 0.002 0.000 0.000 0.002 20 Ethon::Easy::Options#nosignal=
|
||||
0.00 0.001 0.000 0.000 0.001 20 Ethon::Easy::Http::Actionable#initialize
|
||||
0.00 0.000 0.000 0.000 0.000 21 <Module::ObjectSpace>#define_finalizer
|
||||
0.00 0.002 0.000 0.000 0.001 20 Ethon::Easy::Http#fabricate
|
||||
0.00 0.001 0.000 0.000 0.001 30 Ethon::Easy::Informations#primary_ip
|
||||
0.00 0.000 0.000 0.000 0.000 119 NilClass#nil?
|
||||
0.00 0.001 0.000 0.000 0.001 30 Ethon::Easy::Informations#redirect_time
|
||||
0.00 0.001 0.000 0.000 0.001 30 Ethon::Easy::Informations#starttransfer_time
|
||||
0.00 0.000 0.000 0.000 0.000 20 Symbol#downcase
|
||||
0.00 0.000 0.000 0.000 0.000 21 Kernel#method
|
||||
0.00 0.000 0.000 0.000 0.000 20 Petstore::Configuration#api_key_with_prefix
|
||||
0.00 0.000 0.000 0.000 0.000 25 <Class::Petstore::Category>#attribute_map
|
||||
0.00 10.974 0.000 0.000 10.974 20 Typhoeus::Request::Cacheable#run
|
||||
0.00 0.000 0.000 0.000 0.000 20 Typhoeus::Request::Callbacks::Types#on_headers
|
||||
0.00 0.001 0.000 0.000 0.001 30 Ethon::Easy::Informations#namelookup_time
|
||||
0.00 0.001 0.000 0.000 0.001 30 Ethon::Easy::Informations#connect_time
|
||||
0.00 0.001 0.000 0.000 0.001 30 Ethon::Easy::Informations#request_size
|
||||
0.00 0.000 0.000 0.000 0.000 21 String#force_encoding
|
||||
0.00 0.000 0.000 0.000 0.000 20 <Module::Typhoeus>#before
|
||||
0.00 0.000 0.000 0.000 0.000 40 Typhoeus::Response::Informations#return_code
|
||||
0.00 0.000 0.000 0.000 0.000 30 Ethon::Easy::Mirror#initialize
|
||||
0.00 0.000 0.000 0.000 0.000 15 Petstore::ApiClient#build_request_body
|
||||
0.00 0.001 0.000 0.000 0.001 30 Ethon::Easy::Informations#redirect_count
|
||||
0.00 0.025 0.000 0.000 0.025 20 Ethon::Easy::Http#http_request
|
||||
0.00 0.001 0.000 0.000 0.001 30 Ethon::Easy::Informations#response_code
|
||||
0.00 0.000 0.000 0.000 0.000 50 Ethon::Easy::Http::Actionable#query_options
|
||||
0.00 0.000 0.000 0.000 0.000 25 <Class::Petstore::Tag>#attribute_map
|
||||
0.00 0.000 0.000 0.000 0.000 25 NilClass#to_s
|
||||
0.00 0.007 0.000 0.000 0.007 20 <Module::Typhoeus::Pool>#release
|
||||
0.00 0.000 0.000 0.000 0.000 20 Ethon::Easy::ResponseCallbacks#on_headers
|
||||
0.00 0.000 0.000 0.000 0.000 20 <Class::Typhoeus::Expectation>#response_for
|
||||
0.00 0.001 0.000 0.000 0.001 20 Ethon::Easy::Http::Actionable#parse_options
|
||||
0.00 0.000 0.000 0.000 0.000 35 Hash#delete
|
||||
0.00 0.000 0.000 0.000 0.000 45 Typhoeus::Response::Informations#response_headers
|
||||
0.00 0.000 0.000 0.000 0.000 20 <Module::Ethon::Curl>#easy_escape
|
||||
0.00 0.000 0.000 0.000 0.000 21 FFI::AutoPointer::Releaser#initialize
|
||||
0.00 0.000 0.000 0.000 0.000 21 Ethon::Easy::Callbacks#header_write_callback
|
||||
0.00 0.000 0.000 0.000 0.000 21 Ethon::Easy::DebugInfo#initialize
|
||||
0.00 0.000 0.000 0.000 0.000 20 Typhoeus::EasyFactory#initialize
|
||||
0.00 0.000 0.000 0.000 0.000 20 Typhoeus::Request::Memoizable#response=
|
||||
0.00 0.000 0.000 0.000 0.000 105 Module#===
|
||||
0.00 0.000 0.000 0.000 0.000 80 String#include?
|
||||
0.00 0.000 0.000 0.000 0.000 21 Ethon::Easy::Callbacks#body_write_callback
|
||||
0.00 0.000 0.000 0.000 0.000 16 Array#join
|
||||
0.00 0.000 0.000 0.000 0.000 20 <Class::Typhoeus::Expectation>#find_by
|
||||
0.00 0.005 0.000 0.000 0.005 5 Petstore::ApiClient#deserialize
|
||||
0.00 0.000 0.000 0.000 0.000 30 Regexp#===
|
||||
0.00 0.006 0.000 0.000 0.006 10 Ethon::Easy::ResponseCallbacks#headers
|
||||
0.00 0.000 0.000 0.000 0.000 21 Ethon::Easy::Callbacks#debug_callback
|
||||
0.00 0.000 0.000 0.000 0.000 20 Ethon::Easy::ResponseCallbacks#on_complete
|
||||
0.00 0.002 0.000 0.000 0.002 20 Ethon::Easy::Options#url=
|
||||
0.00 0.000 0.000 0.000 0.000 84 Kernel#kind_of?
|
||||
0.00 0.000 0.000 0.000 0.000 40 Typhoeus::Request::Cacheable#cacheable?
|
||||
0.00 0.017 0.000 0.000 0.017 21 Ethon::Easy#set_attributes
|
||||
0.00 0.000 0.000 0.000 0.000 20 Module#const_defined?
|
||||
0.00 0.001 0.000 0.000 0.001 20 <Module::Typhoeus::Pool>#get
|
||||
0.00 0.000 0.000 0.000 0.000 20 <Module::Process>#pid
|
||||
0.00 0.000 0.000 0.000 0.000 40 String#bytesize
|
||||
0.00 0.000 0.000 0.000 0.000 20 Ethon::Easy::Params#initialize
|
||||
0.00 0.000 0.000 0.000 0.000 20 Kernel#lambda
|
||||
0.00 0.000 0.000 0.000 0.000 20 String#capitalize
|
||||
0.00 0.000 0.000 0.000 0.000 25 Ethon::Easy::Queryable#query_pairs
|
||||
0.00 0.000 0.000 0.000 0.000 195 Symbol#===
|
||||
0.00 0.000 0.000 0.000 0.000 20 Ethon::Easy::Form#initialize
|
||||
0.00 0.000 0.000 0.000 0.000 13 FFI::MemoryPointer#initialize
|
||||
0.00 0.000 0.000 0.000 0.000 105 Hash#key?
|
||||
0.00 0.000 0.000 0.000 0.000 20 Ethon::Easy#escape
|
||||
0.00 0.000 0.000 0.000 0.000 20 <Class::Typhoeus::Expectation>#all
|
||||
0.00 0.000 0.000 0.000 0.000 10 Typhoeus::Request::Callbacks#execute_headers_callbacks
|
||||
0.00 0.000 0.000 0.000 0.000 20 Typhoeus::Response::Header#set_default_proc_on
|
||||
0.00 0.000 0.000 0.000 0.000 15 Hash#update
|
||||
0.00 0.000 0.000 0.000 0.000 60 FFI::Pointer#null?
|
||||
0.00 0.001 0.000 0.000 0.001 20 Ethon::Easy::Options#sslcert=
|
||||
0.00 0.001 0.000 0.000 0.001 20 Ethon::Easy::Queryable#to_s
|
||||
0.00 0.000 0.000 0.000 0.000 55 Ethon::Easy::Queryable#empty?
|
||||
0.00 0.000 0.000 0.000 0.000 20 Hash#default_proc=
|
||||
0.00 0.000 0.000 0.000 0.000 10 Petstore::Category#initialize
|
||||
0.00 0.000 0.000 0.000 0.000 10 Petstore::Tag#initialize
|
||||
0.00 0.000 0.000 0.000 0.000 21 FFI::Pointer#initialize
|
||||
0.00 0.002 0.000 0.000 0.001 20 Ethon::Easy::Options#verbose=
|
||||
0.00 0.002 0.000 0.000 0.002 20 Ethon::Easy::Options#maxredirs=
|
||||
0.00 0.001 0.000 0.000 0.001 20 Ethon::Easy::Options#sslkey=
|
||||
0.00 0.000 0.000 0.000 0.000 20 Array#pop
|
||||
0.00 0.000 0.000 0.000 0.000 21 FFI::Pointer#type_size
|
||||
0.00 0.000 0.000 0.000 0.000 20 Ethon::Easy::Http::Actionable#url
|
||||
0.00 0.000 0.000 0.000 0.000 20 Typhoeus::Request::BlockConnection#blocked?
|
||||
0.00 0.002 0.000 0.000 0.002 20 Ethon::Easy::Options#ssl_verifypeer=
|
||||
0.00 0.000 0.000 0.000 0.000 20 Ethon::Easy::Http::Actionable#options
|
||||
0.00 0.000 0.000 0.000 0.000 10 Ethon::Easy::ResponseCallbacks#body
|
||||
0.00 0.000 0.000 0.000 0.000 10 Petstore::Pet#status=
|
||||
0.00 0.001 0.000 0.000 0.001 20 Ethon::Easy::Options#cainfo=
|
||||
0.00 0.000 0.000 0.000 0.000 30 Array#last
|
||||
0.00 0.001 0.000 0.000 0.001 20 Petstore::ApiClient#update_params_for_auth!
|
||||
0.00 0.003 0.000 0.000 0.003 5 Petstore::ApiClient#convert_to_type
|
||||
0.00 10.998 0.000 0.000 10.998 1 PetstoreProfiling#run
|
||||
0.00 0.012 0.000 0.000 0.011 10 Ethon::Easy::Http::Post#setup
|
||||
0.00 0.000 0.000 0.000 0.000 5 JSON::Ext::Parser#initialize
|
||||
0.00 0.000 0.000 0.000 0.000 20 Typhoeus::Request::Memoizable#memoizable?
|
||||
0.00 0.000 0.000 0.000 0.000 20 Typhoeus::Response::Header#raw
|
||||
0.00 0.002 0.000 0.000 0.002 5 Petstore::ApiClient#object_to_http_body
|
||||
0.00 0.000 0.000 0.000 0.000 20 Typhoeus::Request::Responseable#response=
|
||||
0.00 0.000 0.000 0.000 0.000 15 Fixnum#to_s
|
||||
0.00 0.001 0.000 0.000 0.001 15 *Petstore::BaseObject#to_hash
|
||||
0.00 0.000 0.000 0.000 0.000 10 Array#any?
|
||||
0.00 0.000 0.000 0.000 0.000 10 Ethon::Easy::Queryable#build_query_pairs
|
||||
0.00 0.000 0.000 0.000 0.000 1 <Module::Ethon::Curl>#easy_init
|
||||
0.00 0.000 0.000 0.000 0.000 10 Ethon::Easy::Queryable#pairs_for
|
||||
0.00 0.001 0.000 0.000 0.000 5 Petstore::PetApi#initialize
|
||||
0.00 0.000 0.000 0.000 0.000 10 Array#compact
|
||||
0.00 0.003 0.000 0.000 0.002 15 *Petstore::BaseObject#build_from_hash
|
||||
0.00 0.000 0.000 0.000 0.000 20 Typhoeus::Request::Streamable#streaming?
|
||||
0.00 0.000 0.000 0.000 0.000 10 Ethon::Easy::Http::Actionable#params_encoding
|
||||
0.00 0.000 0.000 0.000 0.000 10 FFI::AbstractMemory#put_bytes
|
||||
0.00 3.494 0.000 0.000 3.494 5 Petstore::PetApi#get_pet_by_id
|
||||
0.00 0.000 0.000 0.000 0.000 20 Proc#to_proc
|
||||
0.00 0.000 0.000 0.000 0.000 5 Petstore::Configuration#api_client
|
||||
0.00 0.006 0.000 0.000 0.006 5 Ethon::Easy::Http::Delete#setup
|
||||
0.00 0.001 0.000 0.000 0.001 10 Ethon::Easy::Options#postfieldsize=
|
||||
0.00 0.001 0.000 0.000 0.001 10 Ethon::Easy::Options#copypostfields=
|
||||
0.00 0.005 0.000 0.000 0.005 5 Ethon::Easy::Http::Get#setup
|
||||
0.00 2.143 0.000 0.000 2.143 5 Petstore::PetApi#add_pet
|
||||
0.00 0.000 0.000 0.000 0.000 20 <Module::Ethon::Curl>#free
|
||||
0.00 0.000 0.000 0.000 0.000 1 Petstore::Configuration#initialize
|
||||
0.00 2.141 0.000 0.000 2.141 5 Petstore::PetApi#delete_pet
|
||||
0.00 0.000 0.000 0.000 0.000 20 Kernel#Array
|
||||
0.00 0.000 0.000 0.000 0.000 45 Kernel#respond_to_missing?
|
||||
0.00 0.000 0.000 0.000 0.000 1 <Module::Ethon::Curl>#global_init
|
||||
0.00 0.000 0.000 0.000 0.000 5 <Class::Petstore::Pet>#swagger_types
|
||||
0.00 0.001 0.000 0.000 0.001 5 Petstore::ApiClient#object_to_hash
|
||||
0.00 0.000 0.000 0.000 0.000 2 Logger#initialize
|
||||
0.00 0.000 0.000 0.000 0.000 10 Ethon::Easy::Form#multipart?
|
||||
0.00 0.000 0.000 0.000 0.000 5 JSON::Ext::Generator::State#initialize_copy
|
||||
0.00 0.000 0.000 0.000 0.000 2 MonitorMixin#initialize
|
||||
0.00 3.220 0.000 0.000 3.220 5 Petstore::PetApi#update_pet_with_form
|
||||
0.00 0.000 0.000 0.000 0.000 5 <Class::Petstore::Tag>#swagger_types
|
||||
0.00 0.000 0.000 0.000 0.000 1 Petstore::ApiClient#initialize
|
||||
0.00 0.003 0.000 0.000 0.003 5 Kernel#tap
|
||||
0.00 0.000 0.000 0.000 0.000 5 JSON#parse
|
||||
0.00 0.000 0.000 0.000 0.000 5 Ethon::Easy::Options#customrequest=
|
||||
0.00 0.000 0.000 0.000 0.000 5 Ethon::Easy::Queryable#recursively_generate_pairs
|
||||
0.00 0.000 0.000 0.000 0.000 5 <Class::Petstore::Category>#swagger_types
|
||||
0.00 0.000 0.000 0.000 0.000 2 Logger::LogDevice#initialize
|
||||
0.00 10.998 0.000 0.000 10.998 1 Integer#times
|
||||
0.00 0.000 0.000 0.000 0.000 1 Petstore::Configuration#base_url
|
||||
0.00 0.000 0.000 0.000 0.000 2 MonitorMixin#mon_initialize
|
||||
0.00 0.000 0.000 0.000 0.000 35 String#===
|
||||
0.00 0.000 0.000 0.000 0.000 3 Kernel#proc
|
||||
0.00 0.000 0.000 0.000 0.000 5 Typhoeus::Response::Informations#response_body
|
||||
0.00 0.000 0.000 0.000 0.000 10 Kernel#===
|
||||
0.00 0.001 0.000 0.000 0.001 1 Ethon::Easy#initialize
|
||||
0.00 0.000 0.000 0.000 0.000 5 Ethon::Easy::Queryable#encode_hash_pairs
|
||||
0.00 0.000 0.000 0.000 0.000 5 String#encoding
|
||||
0.00 0.000 0.000 0.000 0.000 5 Array#first
|
||||
0.00 0.000 0.000 0.000 0.000 5 Hash#[]
|
||||
0.00 0.000 0.000 0.000 0.000 2 BasicObject#initialize
|
||||
0.00 0.000 0.000 0.000 0.000 1 Ethon::Loggable#default_logger
|
||||
0.00 0.000 0.000 0.000 0.000 2 Logger::Formatter#initialize
|
||||
0.00 0.000 0.000 0.000 0.000 1 <Module::Ethon::Curl>#init
|
||||
0.00 0.000 0.000 0.000 0.000 2 Mutex#initialize
|
||||
0.00 0.000 0.000 0.000 0.000 1 Ethon::Loggable#rails_logger
|
||||
0.00 0.000 0.000 0.000 0.000 10 BasicObject#==
|
||||
|
||||
* indicates recursively called methods
|
75
samples/client/petstore/ruby-httpx/petstore_profiling.rb
Normal file
75
samples/client/petstore/ruby-httpx/petstore_profiling.rb
Normal file
@ -0,0 +1,75 @@
|
||||
# To run this profiling:
|
||||
# gem install ruby-prof
|
||||
# ruby -Ilib petstore_profiling.rb
|
||||
|
||||
require 'petstore'
|
||||
require 'ruby-prof'
|
||||
|
||||
class PetstoreProfiling
|
||||
attr_accessor :total, :new_pet_id, :output_file
|
||||
|
||||
def initialize
|
||||
@total = 5
|
||||
@new_pet_id = 50002
|
||||
@output_file = './petstore_profiling.output'
|
||||
end
|
||||
|
||||
def call_apis
|
||||
pet_api = Petstore::PetApi.new
|
||||
|
||||
### ADD PET ###
|
||||
pet = Petstore::Pet.new
|
||||
pet.id = new_pet_id
|
||||
pet.name = "profiler"
|
||||
pet.status = "available"
|
||||
pet.photo_urls = ["http://profiler.com"]
|
||||
# new tag
|
||||
tag = Petstore::Tag.new
|
||||
tag.id = new_pet_id # use the same id as pet
|
||||
tag.name = "profile tag 1"
|
||||
# new category
|
||||
category = Petstore::Category.new
|
||||
category.id = new_pet_id # use the same id as pet
|
||||
category.name = "profile category 1"
|
||||
|
||||
pet.tags = [tag]
|
||||
pet.category = category
|
||||
|
||||
# add a new pet (model)
|
||||
pet_api.add_pet(body: pet)
|
||||
|
||||
### GET PET ###
|
||||
pet = pet_api.get_pet_by_id(new_pet_id)
|
||||
|
||||
### UPDATE PET WITH FORM ###
|
||||
pet_api.update_pet_with_form(new_pet_id, name: 'new profiler', status: 'sold')
|
||||
|
||||
### DELETE PET ###
|
||||
pet_api.delete_pet(new_pet_id)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Caught error: #{e.message}"
|
||||
puts "HTTP response headers: #{e.response_headers}"
|
||||
puts "HTTP response body: #{e.response_body}"
|
||||
puts "HTTP status code: #{e.code}"
|
||||
end
|
||||
|
||||
def run
|
||||
puts "Running profiling... (total: #{@total})"
|
||||
|
||||
RubyProf.start
|
||||
@total.times { call_apis }
|
||||
result = RubyProf.stop
|
||||
|
||||
printer = RubyProf::FlatPrinter.new(result)
|
||||
File.open(@output_file, 'w') do |file|
|
||||
printer.print(file)
|
||||
end
|
||||
|
||||
puts "Profiling results written to #{@output_file}"
|
||||
end
|
||||
end
|
||||
|
||||
if __FILE__ == $0
|
||||
profiling = PetstoreProfiling.new
|
||||
profiling.run
|
||||
end
|
@ -1,10 +1,10 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>RubyPetstoreHttpxClientTests</artifactId>
|
||||
<artifactId>RubyHttpxPetstoreClientTests</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>Ruby OpenAPI Httpx Petstore Client</name>
|
||||
<name>Ruby Httpx Petstore Client</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -34,7 +34,7 @@ describe 'DefaultApi' do
|
||||
|
||||
# unit tests for foo_get
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [FooGetDefaultResponse]
|
||||
# @return [InlineResponseDefault]
|
||||
describe 'foo_get test' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -32,16 +32,6 @@ describe 'FakeApi' do
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for fake_big_decimal_map
|
||||
# for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [FakeBigDecimalMap200Response]
|
||||
describe 'fake_big_decimal_map test' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for fake_health_get
|
||||
# Health check endpoint
|
||||
# @param [Hash] opts the optional parameters
|
||||
@ -109,31 +99,9 @@ describe 'FakeApi' do
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for fake_property_enum_integer_serialize
|
||||
# Test serialization of enum (int) properties with examples
|
||||
# @param outer_object_with_enum_property Input enum (int) as post body
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [OuterObjectWithEnumProperty]
|
||||
describe 'fake_property_enum_integer_serialize test' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for test_body_with_binary
|
||||
# For this test, the body has to be a binary file.
|
||||
# @param body image to upload
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
describe 'test_body_with_binary test' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for test_body_with_file_schema
|
||||
# For this test, the body for this request must reference a schema named `File`.
|
||||
# @param file_schema_test_class
|
||||
# For this test, the body for this request much reference a schema named `File`.
|
||||
# @param file_schema_test_class
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
describe 'test_body_with_file_schema test' do
|
||||
@ -143,8 +111,8 @@ describe 'FakeApi' do
|
||||
end
|
||||
|
||||
# unit tests for test_body_with_query_params
|
||||
# @param query
|
||||
# @param user
|
||||
# @param query
|
||||
# @param user
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
describe 'test_body_with_query_params test' do
|
||||
@ -166,8 +134,8 @@ describe 'FakeApi' do
|
||||
end
|
||||
|
||||
# unit tests for test_endpoint_parameters
|
||||
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
# @param number None
|
||||
# @param double None
|
||||
# @param pattern_without_delimiter None
|
||||
@ -180,7 +148,7 @@ describe 'FakeApi' do
|
||||
# @option opts [String] :string None
|
||||
# @option opts [File] :binary None
|
||||
# @option opts [Date] :date None
|
||||
# @option opts [Time] :date_time None
|
||||
# @option opts [DateTime] :date_time None
|
||||
# @option opts [String] :password None
|
||||
# @option opts [String] :callback None
|
||||
# @return [nil]
|
||||
@ -200,7 +168,6 @@ describe 'FakeApi' do
|
||||
# @option opts [String] :enum_query_string Query parameter enum test (string)
|
||||
# @option opts [Integer] :enum_query_integer Query parameter enum test (double)
|
||||
# @option opts [Float] :enum_query_double Query parameter enum test (double)
|
||||
# @option opts [Array<EnumClass>] :enum_query_model_array
|
||||
# @option opts [Array<String>] :enum_form_string_array Form parameter enum test (string array)
|
||||
# @option opts [String] :enum_form_string Form parameter enum test (string)
|
||||
# @return [nil]
|
||||
@ -229,7 +196,6 @@ describe 'FakeApi' do
|
||||
|
||||
# unit tests for test_inline_additional_properties
|
||||
# test inline additionalProperties
|
||||
#
|
||||
# @param request_body request body
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
@ -239,21 +205,8 @@ describe 'FakeApi' do
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for test_inline_freeform_additional_properties
|
||||
# test inline free-form additionalProperties
|
||||
#
|
||||
# @param test_inline_freeform_additional_properties_request request body
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
describe 'test_inline_freeform_additional_properties test' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for test_json_form_data
|
||||
# test json serialization of form data
|
||||
#
|
||||
# @param param field1
|
||||
# @param param2 field2
|
||||
# @param [Hash] opts the optional parameters
|
||||
@ -264,28 +217,14 @@ describe 'FakeApi' do
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for test_nullable
|
||||
# test nullable parent property
|
||||
#
|
||||
# @param child_with_nullable request body
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
describe 'test_nullable test' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for test_query_parameter_collection_format
|
||||
# To test the collection format in query parameters
|
||||
# @param pipe
|
||||
# @param ioutil
|
||||
# @param http
|
||||
# @param url
|
||||
# @param context
|
||||
# @param allow_empty
|
||||
# @param pipe
|
||||
# @param ioutil
|
||||
# @param http
|
||||
# @param url
|
||||
# @param context
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [Hash<String, String>] :language
|
||||
# @return [nil]
|
||||
describe 'test_query_parameter_collection_format test' do
|
||||
it 'should work' do
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -34,7 +34,6 @@ describe 'PetApi' do
|
||||
|
||||
# unit tests for add_pet
|
||||
# Add a new pet to the store
|
||||
#
|
||||
# @param pet Pet object that needs to be added to the store
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
@ -46,10 +45,9 @@ describe 'PetApi' do
|
||||
|
||||
# unit tests for delete_pet
|
||||
# Deletes a pet
|
||||
#
|
||||
# @param pet_id Pet id to delete
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :api_key
|
||||
# @option opts [String] :api_key
|
||||
# @return [nil]
|
||||
describe 'delete_pet test' do
|
||||
it 'should work' do
|
||||
@ -95,7 +93,6 @@ describe 'PetApi' do
|
||||
|
||||
# unit tests for update_pet
|
||||
# Update an existing pet
|
||||
#
|
||||
# @param pet Pet object that needs to be added to the store
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
@ -107,7 +104,6 @@ describe 'PetApi' do
|
||||
|
||||
# unit tests for update_pet_with_form
|
||||
# Updates a pet in the store with form data
|
||||
#
|
||||
# @param pet_id ID of pet that needs to be updated
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :name Updated name of the pet
|
||||
@ -121,7 +117,6 @@ describe 'PetApi' do
|
||||
|
||||
# unit tests for upload_file
|
||||
# uploads an image
|
||||
#
|
||||
# @param pet_id ID of pet to update
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :additional_metadata Additional data to pass to server
|
||||
@ -135,7 +130,6 @@ describe 'PetApi' do
|
||||
|
||||
# unit tests for upload_file_with_required_file
|
||||
# uploads an image (required)
|
||||
#
|
||||
# @param pet_id ID of pet to update
|
||||
# @param required_file file to upload
|
||||
# @param [Hash] opts the optional parameters
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -69,7 +69,6 @@ describe 'StoreApi' do
|
||||
|
||||
# unit tests for place_order
|
||||
# Place an order for a pet
|
||||
#
|
||||
# @param order order placed for purchasing the pet
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Order]
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -46,7 +46,6 @@ describe 'UserApi' do
|
||||
|
||||
# unit tests for create_users_with_array_input
|
||||
# Creates list of users with given input array
|
||||
#
|
||||
# @param user List of user object
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
@ -58,7 +57,6 @@ describe 'UserApi' do
|
||||
|
||||
# unit tests for create_users_with_list_input
|
||||
# Creates list of users with given input array
|
||||
#
|
||||
# @param user List of user object
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
@ -82,7 +80,6 @@ describe 'UserApi' do
|
||||
|
||||
# unit tests for get_user_by_name
|
||||
# Get user by user name
|
||||
#
|
||||
# @param username The name that needs to be fetched. Use user1 for testing.
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [User]
|
||||
@ -94,7 +91,6 @@ describe 'UserApi' do
|
||||
|
||||
# unit tests for login_user
|
||||
# Logs user into the system
|
||||
#
|
||||
# @param username The user name for login
|
||||
# @param password The password for login in clear text
|
||||
# @param [Hash] opts the optional parameters
|
||||
@ -107,7 +103,6 @@ describe 'UserApi' do
|
||||
|
||||
# unit tests for logout_user
|
||||
# Logs out current logged in user session
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
describe 'logout_user test' do
|
||||
|
@ -0,0 +1,20 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Petstore::ApiClient do
|
||||
describe '#initialize' do
|
||||
it "should save the message if one is given" do
|
||||
err = Petstore::ApiError.new(message: "Hello")
|
||||
expect(err.message).to eq("Hello")
|
||||
end
|
||||
|
||||
it "should save the message and code if both are given" do
|
||||
err = Petstore::ApiError.new(message: "Hello", code: 0)
|
||||
expect(err.message).to eq("Hello\nHTTP status code: 0")
|
||||
end
|
||||
|
||||
it "should save the hash as message if no message is given" do
|
||||
err = Petstore::ApiError.new(code: 500, response_body: "server error")
|
||||
expect(err.message).to eq("Error message: the server returns an error\nHTTP status code: 500\nResponse body: server error")
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,169 @@
|
||||
require 'spec_helper'
|
||||
|
||||
class ArrayMapObject < Petstore::Category
|
||||
attr_accessor :int_arr, :pet_arr, :int_map, :pet_map, :int_arr_map, :pet_arr_map, :boolean_true_arr, :boolean_false_arr
|
||||
|
||||
def self.attribute_map
|
||||
{
|
||||
:int_arr => :int_arr,
|
||||
:pet_arr => :pet_arr,
|
||||
:int_map => :int_map,
|
||||
:pet_map => :pet_map,
|
||||
:int_arr_map => :int_arr_map,
|
||||
:pet_arr_map => :pet_arr_map,
|
||||
:boolean_true_arr => :boolean_true_arr,
|
||||
:boolean_false_arr => :boolean_false_arr,
|
||||
}
|
||||
end
|
||||
|
||||
def self.openapi_types
|
||||
{
|
||||
:int_arr => :'Array<Integer>',
|
||||
:pet_arr => :'Array<Pet>',
|
||||
:int_map => :'Hash<String, Integer>',
|
||||
:pet_map => :'Hash<String, Pet>',
|
||||
:int_arr_map => :'Hash<String, Array<Integer>>',
|
||||
:pet_arr_map => :'Hash<String, Array<Pet>>',
|
||||
:boolean_true_arr => :'Array<Boolean>',
|
||||
:boolean_false_arr => :'Array<Boolean>',
|
||||
}
|
||||
end
|
||||
|
||||
def initialize(attributes = {})
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `ArrayMapObject` initialize method"
|
||||
end
|
||||
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
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 `ArrayMapObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.key?(:'int_arr')
|
||||
if (value = attributes[:'int_arr']).is_a?(Array)
|
||||
self.int_arr = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.key?(:'pet_arr')
|
||||
if (value = attributes[:'pet_arr']).is_a?(Array)
|
||||
self.pet_arr = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.key?(:'int_map')
|
||||
if (value = attributes[:'int_map']).is_a?(Hash)
|
||||
self.int_map = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.key?(:'pet_map')
|
||||
if (value = attributes[:'pet_map']).is_a?(Hash)
|
||||
self.pet_map = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.key?(:'int_arr_map')
|
||||
if (value = attributes[:'int_arr_map']).is_a?(Hash)
|
||||
self.int_arr_map = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.key?(:'pet_arr_map')
|
||||
if (value = attributes[:'pet_arr_map']).is_a?(Hash)
|
||||
self.pet_arr_map = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.key?(:'boolean_true_arr')
|
||||
if (value = attributes[:'boolean_true_arr']).is_a?(Array)
|
||||
self.boolean_true_arr = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.key?(:'boolean_false_arr')
|
||||
if (value = attributes[:'boolean_false_arr']).is_a?(Array)
|
||||
self.boolean_false_arr = value
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'BaseObject' do
|
||||
describe 'boolean values' do
|
||||
let(:obj) { Petstore::Cat.new(declawed: false) }
|
||||
|
||||
it 'should have values set' do
|
||||
expect(obj.declawed).not_to be_nil
|
||||
expect(obj.declawed).to eq(false)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'array and map properties' do
|
||||
let(:data) do
|
||||
{ int_arr: [123, 456],
|
||||
pet_arr: [{ name: 'Kitty', photoUrls: ['www.photo-url.test'] }],
|
||||
int_map: { 'int' => 123 },
|
||||
pet_map: { 'pet' => { name: 'Kitty', photoUrls: ['www.photo-url.test'] } },
|
||||
int_arr_map: { 'int_arr' => [123, 456] },
|
||||
pet_arr_map: { 'pet_arr' => [{ name: 'Kitty', photoUrls: ['www.photo-url.test'] }] },
|
||||
boolean_true_arr: [true, "true", "TruE", 1, "y", "yes", "1", "t", "T"],
|
||||
boolean_false_arr: [false, "", 0, "0", "f", nil, "null", "\ntrue\n"],
|
||||
}
|
||||
end
|
||||
|
||||
it 'works for #build_from_hash' do
|
||||
obj = ArrayMapObject.build_from_hash(data)
|
||||
|
||||
expect(obj.int_arr).to match_array([123, 456])
|
||||
|
||||
expect(obj.pet_arr).to be_instance_of(Array)
|
||||
expect(obj.pet_arr.size).to eq(1)
|
||||
|
||||
pet = obj.pet_arr.first
|
||||
expect(pet).to be_instance_of(Petstore::Pet)
|
||||
expect(pet.name).to eq('Kitty')
|
||||
|
||||
expect(obj.int_map).to be_instance_of(Hash)
|
||||
expect(obj.int_map).to eq('int' => 123)
|
||||
|
||||
expect(obj.pet_map).to be_instance_of(Hash)
|
||||
pet = obj.pet_map['pet']
|
||||
expect(pet).to be_instance_of(Petstore::Pet)
|
||||
expect(pet.name).to eq('Kitty')
|
||||
|
||||
expect(obj.int_arr_map).to be_instance_of(Hash)
|
||||
arr = obj.int_arr_map['int_arr']
|
||||
expect(arr).to match_array([123, 456])
|
||||
|
||||
expect(obj.pet_arr_map).to be_instance_of(Hash)
|
||||
arr = obj.pet_arr_map['pet_arr']
|
||||
expect(arr).to be_instance_of(Array)
|
||||
expect(arr.size).to eq(1)
|
||||
pet = arr.first
|
||||
expect(pet).to be_instance_of(Petstore::Pet)
|
||||
expect(pet.name).to eq('Kitty')
|
||||
|
||||
expect(obj.boolean_true_arr).to be_instance_of(Array)
|
||||
obj.boolean_true_arr.each do |b|
|
||||
expect(b).to eq(true)
|
||||
end
|
||||
|
||||
expect(obj.boolean_false_arr).to be_instance_of(Array)
|
||||
obj.boolean_false_arr.each do |b|
|
||||
expect(b).to eq(false)
|
||||
end
|
||||
end
|
||||
|
||||
it 'works for #to_hash' do
|
||||
obj = ArrayMapObject.build_from_hash(data)
|
||||
expect_data = data.dup
|
||||
expect_data[:boolean_true_arr].map! { true }
|
||||
expect_data[:boolean_false_arr].map! { false }
|
||||
expect(obj.to_hash).to eq(expect_data)
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,75 @@
|
||||
=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
|
||||
OpenAPI Generator version: 7.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe Petstore::Configuration do
|
||||
let(:config) { Petstore::Configuration.new }
|
||||
|
||||
before(:each) do
|
||||
# uncomment below to setup host and base_path
|
||||
# require 'URI'
|
||||
# uri = URI.parse("http://petstore.swagger.io:80/v2")
|
||||
# Petstore.configure do |c|
|
||||
# c.host = uri.host
|
||||
# c.base_path = uri.path
|
||||
# end
|
||||
end
|
||||
|
||||
describe '#base_url' do
|
||||
it 'should have the default value' do
|
||||
expect(config.base_url).to eq("http://petstore.swagger.io/v2")
|
||||
end
|
||||
|
||||
it 'returns default value when invalid operation is passed' do
|
||||
expect(config.base_url('invalid_operation')).to eq('http://petstore.swagger.io/v2')
|
||||
end
|
||||
|
||||
it 'returns proper URL default server_index' do
|
||||
expect(config.base_url(:'PetApi.add_pet')).to eq('http://petstore.swagger.io/v2')
|
||||
end
|
||||
|
||||
it 'returns proper URL when server_index is set' do
|
||||
config.server_index = 1
|
||||
expect(config.base_url(:'PetApi.add_pet')).to eq('http://path-server-test.petstore.local/v2')
|
||||
end
|
||||
|
||||
it 'returns proper URL when server_operation_index is set' do
|
||||
config.server_operation_index = {
|
||||
:'PetApi.add_pet' => 1
|
||||
}
|
||||
expect(config.base_url(:'PetApi.add_pet')).to eq('http://path-server-test.petstore.local/v2')
|
||||
end
|
||||
|
||||
it 'returns proper URL from server_settings when server_index is set' do
|
||||
config.server_index = 1
|
||||
expect(config.base_url).to eq('https://localhost:8080/v2')
|
||||
end
|
||||
|
||||
it 'throws argument error when attempting to use a server index that is out of bounds' do
|
||||
config.server_operation_index = {
|
||||
:'PetApi.add_pet' => 10
|
||||
}
|
||||
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 4')
|
||||
end
|
||||
|
||||
it 'should remove trailing slashes' do
|
||||
[nil, '', '/', '//'].each do |base_path|
|
||||
config.base_path = base_path
|
||||
# uncomment below to test trailing slashes
|
||||
# expect(config.base_url).to eq("http://petstore.swagger.io:80/v2")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
73
samples/client/petstore/ruby-httpx/spec/custom/model_spec.rb
Normal file
73
samples/client/petstore/ruby-httpx/spec/custom/model_spec.rb
Normal file
@ -0,0 +1,73 @@
|
||||
require 'petstore_helper'
|
||||
require 'spec_helper'
|
||||
require 'json'
|
||||
|
||||
describe "Mammal" do
|
||||
before do
|
||||
end
|
||||
|
||||
after do
|
||||
end
|
||||
|
||||
describe "anyOf" do
|
||||
it "should construct a new anyOf object mammal_anyof" do
|
||||
whale = Petstore::Whale.new('classname' => "Whale", 'has_teeth' => true)
|
||||
zebra = Petstore::Zebra.new('classname' => "Zebra", 'type' => 'plains')
|
||||
|
||||
# oneOf whale test
|
||||
expect(whale.to_hash[:'classname']).to eq("Whale")
|
||||
result = Petstore::MammalAnyof.build(whale.to_hash)
|
||||
expect(result).to be_a Petstore::Whale
|
||||
|
||||
# oneOf zebra test
|
||||
expect(zebra.to_hash[:'classname']).to eq("Zebra")
|
||||
result2 = Petstore::MammalAnyof.build(zebra.to_hash)
|
||||
expect(result2).to be_a Petstore::Zebra
|
||||
|
||||
# invalid data/hash should result in nil
|
||||
result3 = Petstore::MammalAnyof.build({"something": 123})
|
||||
expect(result3).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
describe "oneOf" do
|
||||
it "should construct a new oneOf object mammal" do
|
||||
whale = Petstore::Whale.new('classname' => "Whale", 'has_teeth' => true)
|
||||
zebra = Petstore::Zebra.new('classname' => "Zebra", 'type' => 'plains')
|
||||
|
||||
# oneOf whale test
|
||||
expect(whale.to_hash[:'classname']).to eq("Whale")
|
||||
result = Petstore::Mammal.build(whale.to_hash)
|
||||
expect(result).to be_a Petstore::Whale
|
||||
|
||||
# oneOf zebra test
|
||||
expect(zebra.to_hash[:'classname']).to eq("Zebra")
|
||||
result2 = Petstore::Mammal.build(zebra.to_hash)
|
||||
expect(result2).to be_a Petstore::Zebra
|
||||
|
||||
# invalid data/hash should result in nil
|
||||
result3 = Petstore::Mammal.build({"something": 123})
|
||||
expect(result3).to be_nil
|
||||
end
|
||||
|
||||
it "should construct a new oneOf object mammal_without_discriminator" do
|
||||
whale = Petstore::Whale.new('classname' => "Whale", 'has_teeth' => true)
|
||||
zebra = Petstore::Zebra.new('classname' => "Zebra", 'type' => 'plains')
|
||||
|
||||
# oneOf whale test
|
||||
expect(whale.to_hash[:'classname']).to eq("Whale")
|
||||
result = Petstore::MammalWithoutDiscriminator.build(whale.to_hash)
|
||||
expect(result).to be_a Petstore::Whale
|
||||
|
||||
# oneOf zebra test
|
||||
expect(zebra.to_hash[:'classname']).to eq("Zebra")
|
||||
result2 = Petstore::MammalWithoutDiscriminator.build(zebra.to_hash)
|
||||
expect(result2).to be_a Petstore::Zebra
|
||||
|
||||
# invalid data/hash should result in nil
|
||||
result3 = Petstore::MammalWithoutDiscriminator.build({"something": 123})
|
||||
expect(result3).to be_nil
|
||||
end
|
||||
|
||||
end
|
||||
end
|
266
samples/client/petstore/ruby-httpx/spec/custom/pet_spec.rb
Normal file
266
samples/client/petstore/ruby-httpx/spec/custom/pet_spec.rb
Normal file
@ -0,0 +1,266 @@
|
||||
require 'petstore_helper'
|
||||
require 'spec_helper'
|
||||
require 'json'
|
||||
|
||||
describe "Pet" do
|
||||
before do
|
||||
@pet_api = Petstore::PetApi.new(API_CLIENT)
|
||||
@pet_id = prepare_pet(@pet_api)
|
||||
end
|
||||
|
||||
after do
|
||||
# remove the testing pet
|
||||
begin
|
||||
@pet_api.delete_pet(@pet_id)
|
||||
rescue Petstore::ApiError => e
|
||||
# ignore ApiError 404 (Not Found)
|
||||
raise e if e.code != 404
|
||||
end
|
||||
end
|
||||
|
||||
describe "pet methods" do
|
||||
it "should construct a new pet object" do
|
||||
tag1 = Petstore::Tag.new('id' => 1, 'name' => 'tag1')
|
||||
tag2 = Petstore::Tag.new('id' => 2, 'name' => 'tag2')
|
||||
category1 = Petstore::Category.new(:id => 1, :name => 'category unknown')
|
||||
# initialize using both string and symbol key
|
||||
pet_hash = {
|
||||
:id => @pet_id,
|
||||
:name => "RUBY UNIT TESTING",
|
||||
:status => "pending",
|
||||
:photo_urls => ["url1", "url2"],
|
||||
:category => category1,
|
||||
:tags => [tag1, tag2]
|
||||
}
|
||||
pet = Petstore::Pet.new(pet_hash)
|
||||
# test new
|
||||
expect(pet.name).to eq("RUBY UNIT TESTING")
|
||||
expect(pet.status).to eq("pending")
|
||||
expect(pet.id).to eq(@pet_id)
|
||||
expect(pet.tags[0].id).to eq(1)
|
||||
expect(pet.tags[1].name).to eq('tag2')
|
||||
expect(pet.category.name).to eq('category unknown')
|
||||
|
||||
# test build_from_hash
|
||||
pet2 = Petstore::Pet.build_from_hash(pet.to_hash)
|
||||
expect(pet.to_hash).to eq(pet2.to_hash)
|
||||
|
||||
# make sure sub-object has different object id
|
||||
expect(pet.tags[0].object_id).not_to eq(pet2.tags[0].object_id)
|
||||
expect(pet.tags[1].object_id).not_to eq(pet2.tags[1].object_id)
|
||||
expect(pet.category.object_id).not_to eq(pet2.category.object_id)
|
||||
end
|
||||
|
||||
it "should fetch a pet object" do
|
||||
pet = @pet_api.get_pet_by_id(@pet_id)
|
||||
expect(pet).to be_a(Petstore::Pet)
|
||||
expect(pet.id).to eq(@pet_id)
|
||||
expect(pet.name).to eq("RUBY UNIT TESTING")
|
||||
expect(pet.tags[0].name).to eq("tag test")
|
||||
expect(pet.category.name).to eq("category test")
|
||||
end
|
||||
|
||||
it "should fetch a pet object using invalid operation path" do
|
||||
# backup index
|
||||
index_backup = @pet_api.api_client.config.server_operation_index
|
||||
expect(index_backup).to eq({})
|
||||
# test operation index 1 (invalid path)
|
||||
@pet_api.api_client.config.server_operation_index = {
|
||||
:'PetApi.get_pet_by_id' => 1
|
||||
}
|
||||
|
||||
expect(@pet_api.api_client.config.base_url(:'PetApi.get_pet_by_id')).to eq('http://path-server-test.petstore.local/v2')
|
||||
|
||||
expect {
|
||||
pet = @pet_api.get_pet_by_id(@pet_id)
|
||||
}.to raise_error(Petstore::ApiError) # path-server-test.petstore.local is invalid (not defined in host table)
|
||||
|
||||
# restore index
|
||||
@pet_api.api_client.config.server_operation_index = index_backup
|
||||
expect(@pet_api.api_client.config.server_operation_index).to eq({})
|
||||
end
|
||||
|
||||
it "should fetch a pet object using operation path" do
|
||||
# backup index
|
||||
index_backup = @pet_api.api_client.config.server_operation_index
|
||||
expect(index_backup).to eq({})
|
||||
# test operation index 3
|
||||
@pet_api.api_client.config.server_operation_index = {
|
||||
:'PetApi.get_pet_by_id' => 3
|
||||
}
|
||||
|
||||
expect(@pet_api.api_client.config.base_url(:'PetApi.get_pet_by_id')).to eq('http://path.v2.test.openapi-generator.tech/v2')
|
||||
|
||||
pet = @pet_api.get_pet_by_id(@pet_id)
|
||||
expect(pet).to be_a(Petstore::Pet)
|
||||
expect(pet.id).to eq(@pet_id)
|
||||
expect(pet.name).to eq("RUBY UNIT TESTING")
|
||||
expect(pet.tags[0].name).to eq("tag test")
|
||||
expect(pet.category.name).to eq("category test")
|
||||
# restore index
|
||||
@pet_api.api_client.config.server_operation_index = index_backup
|
||||
expect(@pet_api.api_client.config.server_operation_index).to eq({})
|
||||
expect(@pet_api.api_client.config.base_url(:'PetApi.get_pet_by_id')).to eq('http://petstore.swagger.io/v2')
|
||||
end
|
||||
|
||||
it "should fetch a pet object with http info" do
|
||||
pet, status_code, headers = @pet_api.get_pet_by_id_with_http_info(@pet_id)
|
||||
expect(status_code).to eq(200)
|
||||
expect(headers['Content-Type']).to eq('application/json')
|
||||
expect(pet).to be_a(Petstore::Pet)
|
||||
expect(pet.id).to eq(@pet_id)
|
||||
expect(pet.name).to eq("RUBY UNIT TESTING")
|
||||
expect(pet.tags[0].name).to eq("tag test")
|
||||
expect(pet.category.name).to eq("category test")
|
||||
end
|
||||
|
||||
it "should not find a pet that does not exist" do
|
||||
begin
|
||||
@pet_api.get_pet_by_id(-@pet_id)
|
||||
fail 'it should raise error'
|
||||
rescue Petstore::ApiError => e
|
||||
expect(e.code).to eq(404)
|
||||
# skip the check as the response contains a timestamp that changes on every response
|
||||
# expect(e.message).to eq("Error message: the server returns an error\nHTTP status code: 404\nResponse headers: {\"Date\"=>\"Tue, 26 Feb 2019 04:35:40 GMT\", \"Access-Control-Allow-Origin\"=>\"*\", \"Access-Control-Allow-Methods\"=>\"GET, POST, DELETE, PUT\", \"Access-Control-Allow-Headers\"=>\"Content-Type, api_key, Authorization\", \"Content-Type\"=>\"application/json\", \"Connection\"=>\"close\", \"Server\"=>\"Jetty(9.2.9.v20150224)\"}\nResponse body: {\"code\":1,\"type\":\"error\",\"message\":\"Pet not found\"}")
|
||||
expect(e.response_body).to eq('{"code":1,"type":"error","message":"Pet not found"}')
|
||||
expect(e.response_headers).to include('Content-Type')
|
||||
expect(e.response_headers['Content-Type']).to eq('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
# skip the following as original petstore spec does not have endpoints for testing byte array
|
||||
# we will re-enable this after updating the petstore server
|
||||
xit "should create and get pet with byte array (binary, string)" do
|
||||
pet = @pet_api.get_pet_by_id(@pet_id)
|
||||
pet.id = @pet_id + 1
|
||||
str = serialize_json(pet)
|
||||
@pet_api.add_pet_using_byte_array(body: str)
|
||||
|
||||
fetched_str = @pet_api.pet_pet_idtesting_byte_arraytrue_get(pet.id)
|
||||
expect(fetched_str).to be_a(String)
|
||||
fetched = deserialize_json(fetched_str, 'Pet')
|
||||
expect(fetched).to be_a(Petstore::Pet)
|
||||
expect(fetched.id).to eq(pet.id)
|
||||
expect(fetched.category).to be_a(Petstore::Category)
|
||||
expect(fetched.category.name).to eq(pet.category.name)
|
||||
|
||||
@pet_api.delete_pet(pet.id)
|
||||
end
|
||||
|
||||
# skip the following as original petstore spec does not have endpoints for testing byte array
|
||||
# we will re-enable this after updating the petstore server
|
||||
xit "should get pet in object" do
|
||||
pet = @pet_api.get_pet_by_id_in_object(@pet_id)
|
||||
expect(pet).to be_a(Petstore::InlineResponse200)
|
||||
expect(pet.id).to eq(@pet_id)
|
||||
expect(pet.name).to eq("RUBY UNIT TESTING")
|
||||
expect(pet.category).to be_a(Hash)
|
||||
expect(pet.category[:id]).to eq(20002)
|
||||
expect(pet.category[:name]).to eq('category test')
|
||||
end
|
||||
|
||||
it "should update a pet" do
|
||||
pet = @pet_api.get_pet_by_id(@pet_id)
|
||||
expect(pet.id).to eq(@pet_id)
|
||||
expect(pet.name).to eq("RUBY UNIT TESTING")
|
||||
expect(pet.status).to eq('pending')
|
||||
|
||||
@pet_api.update_pet_with_form(@pet_id, name: 'new name', status: 'sold')
|
||||
|
||||
fetched = @pet_api.get_pet_by_id(@pet_id)
|
||||
expect(fetched.id).to eq(@pet_id)
|
||||
expect(fetched.name).to eq("new name")
|
||||
expect(fetched.status).to eq('sold')
|
||||
end
|
||||
|
||||
it "should find pets by status" do
|
||||
pets = @pet_api.find_pets_by_status(['available'])
|
||||
expect(pets.length).to be >= 3
|
||||
pets.each do |pet|
|
||||
expect(pet).to be_a(Petstore::Pet)
|
||||
expect(pet.status).to eq('available')
|
||||
end
|
||||
end
|
||||
|
||||
it "should not find a pet with invalid status" do
|
||||
pets = @pet_api.find_pets_by_status(['invalid-status'])
|
||||
expect(pets.length).to eq(0)
|
||||
end
|
||||
|
||||
it "should find a pet by status" do
|
||||
pets = @pet_api.find_pets_by_status(["available", "sold"])
|
||||
pets.each do |pet|
|
||||
if pet.status != 'available' && pet.status != 'sold'
|
||||
raise "pet status wasn't right"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it "should create a pet" do
|
||||
id = @pet_id + 1
|
||||
|
||||
pet = Petstore::Pet.new('id' => id, 'name' => "RUBY UNIT TESTING", 'photo_urls' => ['www.photo-url.test'])
|
||||
result = @pet_api.add_pet(pet)
|
||||
# nothing is returned
|
||||
expect(result).to be_nil
|
||||
|
||||
pet = @pet_api.get_pet_by_id(id)
|
||||
expect(pet.id).to eq(id)
|
||||
expect(pet.name).to eq("RUBY UNIT TESTING")
|
||||
expect(pet.photo_urls).to match_array(['www.photo-url.test'])
|
||||
|
||||
@pet_api.delete_pet(id)
|
||||
end
|
||||
|
||||
it "should upload a file to a pet" do
|
||||
result = @pet_api.upload_file(@pet_id, file: File.new('hello.txt'))
|
||||
# ApiResponse is returned
|
||||
expect(result).to be_a(Petstore::ApiResponse)
|
||||
end
|
||||
|
||||
it "should upload a file with form parameter to a pet" do
|
||||
result = @pet_api.upload_file(@pet_id, file: File.new('hello.txt'), additional_metadata: 'metadata')
|
||||
# ApiResponse is returned
|
||||
expect(result).to be_a(Petstore::ApiResponse)
|
||||
end
|
||||
|
||||
it "should implement eql? and hash" do
|
||||
pet_hash = {
|
||||
name: 'test_name',
|
||||
photo_urls: ['www.photo-url.test']
|
||||
}
|
||||
pet1 = Petstore::Pet.new(pet_hash)
|
||||
pet2 = Petstore::Pet.new(pet_hash)
|
||||
expect(pet1).to eq(pet2)
|
||||
expect(pet2).to eq(pet1)
|
||||
expect(pet1.eql?(pet2)).to eq(true)
|
||||
expect(pet2.eql?(pet1)).to eq(true)
|
||||
expect(pet1.hash).to eq(pet2.hash)
|
||||
expect(pet1).to eq(pet1)
|
||||
expect(pet1.eql?(pet1)).to eq(true)
|
||||
expect(pet1.hash).to eq(pet1.hash)
|
||||
|
||||
pet1.name = 'really-happy'
|
||||
pet1.photo_urls = ['http://foo.bar.com/1', 'http://foo.bar.com/2']
|
||||
expect(pet1).not_to eq(pet2)
|
||||
expect(pet2).not_to eq(pet1)
|
||||
expect(pet1.eql?(pet2)).to eq(false)
|
||||
expect(pet2.eql?(pet1)).to eq(false)
|
||||
expect(pet1.hash).not_to eq(pet2.hash)
|
||||
expect(pet1).to eq(pet1)
|
||||
expect(pet1.eql?(pet1)).to eq(true)
|
||||
expect(pet1.hash).to eq(pet1.hash)
|
||||
|
||||
pet2.name = 'really-happy'
|
||||
pet2.photo_urls = ['http://foo.bar.com/1', 'http://foo.bar.com/2']
|
||||
expect(pet1).to eq(pet2)
|
||||
expect(pet2).to eq(pet1)
|
||||
expect(pet1.eql?(pet2)).to eq(true)
|
||||
expect(pet2.eql?(pet1)).to eq(true)
|
||||
expect(pet1.hash).to eq(pet2.hash)
|
||||
expect(pet2).to eq(pet2)
|
||||
expect(pet2.eql?(pet2)).to eq(true)
|
||||
expect(pet2.hash).to eq(pet2.hash)
|
||||
end
|
||||
end
|
||||
end
|
39
samples/client/petstore/ruby-httpx/spec/custom/store_spec.rb
Normal file
39
samples/client/petstore/ruby-httpx/spec/custom/store_spec.rb
Normal file
@ -0,0 +1,39 @@
|
||||
require 'spec_helper'
|
||||
require 'petstore_helper'
|
||||
|
||||
describe "Store" do
|
||||
before do
|
||||
@api = Petstore::StoreApi.new(API_CLIENT)
|
||||
end
|
||||
|
||||
it "should fetch an order" do
|
||||
@order_id = prepare_store(@api)
|
||||
|
||||
item = @api.get_order_by_id(@order_id)
|
||||
expect(item.id).to eq(@order_id)
|
||||
|
||||
@api.delete_order(@order_id)
|
||||
end
|
||||
|
||||
it "should fetch the inventory" do
|
||||
result = @api.get_inventory
|
||||
expect(result).to be_a(Hash)
|
||||
expect(result).not_to be_empty
|
||||
result.each do |k, v|
|
||||
expect(k).to be_a(Symbol)
|
||||
expect(v).to be_a(Integer)
|
||||
end
|
||||
end
|
||||
|
||||
# mark as pending since original petstore does not return object
|
||||
# will re-enable this after updating the petstore server
|
||||
xit "should fetch the inventory in object" do
|
||||
result = @api.get_inventory_in_object
|
||||
expect(result).to be_a(Hash)
|
||||
expect(result).not_to be_empty
|
||||
result.each do |k, v|
|
||||
expect(k).to be_a(Symbol)
|
||||
expect(v).to be_a(Integer)
|
||||
end
|
||||
end
|
||||
end
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,21 @@ require 'date'
|
||||
# Unit tests for Petstore::AdditionalPropertiesClass
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::AdditionalPropertiesClass do
|
||||
let(:instance) { Petstore::AdditionalPropertiesClass.new }
|
||||
describe 'AdditionalPropertiesClass' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::AdditionalPropertiesClass.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of AdditionalPropertiesClass' do
|
||||
it 'should create an instance of AdditionalPropertiesClass' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::AdditionalPropertiesClass)
|
||||
expect(@instance).to be_instance_of(Petstore::AdditionalPropertiesClass)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "map_property"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 7.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -22,11 +22,9 @@ describe Petstore::AllOfWithSingleRef do
|
||||
|
||||
describe 'test an instance of AllOfWithSingleRef' do
|
||||
it 'should create an instance of AllOfWithSingleRef' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::AllOfWithSingleRef)
|
||||
expect(instance).to be_instance_of(Petstore::AllOfWithSingleRef)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "username"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,21 @@ require 'date'
|
||||
# Unit tests for Petstore::Animal
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::Animal do
|
||||
let(:instance) { Petstore::Animal.new }
|
||||
describe 'Animal' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::Animal.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of Animal' do
|
||||
it 'should create an instance of Animal' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::Animal)
|
||||
expect(@instance).to be_instance_of(Petstore::Animal)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "class_name"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,21 @@ require 'date'
|
||||
# Unit tests for Petstore::ApiResponse
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::ApiResponse do
|
||||
let(:instance) { Petstore::ApiResponse.new }
|
||||
describe 'ApiResponse' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::ApiResponse.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of ApiResponse' do
|
||||
it 'should create an instance of ApiResponse' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::ApiResponse)
|
||||
expect(@instance).to be_instance_of(Petstore::ApiResponse)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "code"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,21 @@ require 'date'
|
||||
# Unit tests for Petstore::ArrayOfArrayOfNumberOnly
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::ArrayOfArrayOfNumberOnly do
|
||||
let(:instance) { Petstore::ArrayOfArrayOfNumberOnly.new }
|
||||
describe 'ArrayOfArrayOfNumberOnly' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::ArrayOfArrayOfNumberOnly.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of ArrayOfArrayOfNumberOnly' do
|
||||
it 'should create an instance of ArrayOfArrayOfNumberOnly' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::ArrayOfArrayOfNumberOnly)
|
||||
expect(@instance).to be_instance_of(Petstore::ArrayOfArrayOfNumberOnly)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "array_array_number"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,21 @@ require 'date'
|
||||
# Unit tests for Petstore::ArrayOfNumberOnly
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::ArrayOfNumberOnly do
|
||||
let(:instance) { Petstore::ArrayOfNumberOnly.new }
|
||||
describe 'ArrayOfNumberOnly' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::ArrayOfNumberOnly.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of ArrayOfNumberOnly' do
|
||||
it 'should create an instance of ArrayOfNumberOnly' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::ArrayOfNumberOnly)
|
||||
expect(@instance).to be_instance_of(Petstore::ArrayOfNumberOnly)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "array_number"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,21 @@ require 'date'
|
||||
# Unit tests for Petstore::ArrayTest
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::ArrayTest do
|
||||
let(:instance) { Petstore::ArrayTest.new }
|
||||
describe 'ArrayTest' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::ArrayTest.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of ArrayTest' do
|
||||
it 'should create an instance of ArrayTest' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::ArrayTest)
|
||||
expect(@instance).to be_instance_of(Petstore::ArrayTest)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "array_of_string"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,21 @@ require 'date'
|
||||
# Unit tests for Petstore::Capitalization
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::Capitalization do
|
||||
let(:instance) { Petstore::Capitalization.new }
|
||||
describe 'Capitalization' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::Capitalization.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of Capitalization' do
|
||||
it 'should create an instance of Capitalization' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::Capitalization)
|
||||
expect(@instance).to be_instance_of(Petstore::Capitalization)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "small_camel"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,21 @@ require 'date'
|
||||
# Unit tests for Petstore::Cat
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::Cat do
|
||||
let(:instance) { Petstore::Cat.new }
|
||||
describe 'Cat' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::Cat.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of Cat' do
|
||||
it 'should create an instance of Cat' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::Cat)
|
||||
expect(@instance).to be_instance_of(Petstore::Cat)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "declawed"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,21 @@ require 'date'
|
||||
# Unit tests for Petstore::Category
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::Category do
|
||||
let(:instance) { Petstore::Category.new }
|
||||
describe 'Category' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::Category.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of Category' do
|
||||
it 'should create an instance of Category' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::Category)
|
||||
expect(@instance).to be_instance_of(Petstore::Category)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "id"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -1,36 +0,0 @@
|
||||
=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
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'spec_helper'
|
||||
require 'json'
|
||||
require 'date'
|
||||
|
||||
# Unit tests for Petstore::ChildWithNullable
|
||||
# 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)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "other_property"' 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
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,21 @@ require 'date'
|
||||
# Unit tests for Petstore::ClassModel
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::ClassModel do
|
||||
let(:instance) { Petstore::ClassModel.new }
|
||||
describe 'ClassModel' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::ClassModel.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of ClassModel' do
|
||||
it 'should create an instance of ClassModel' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::ClassModel)
|
||||
expect(@instance).to be_instance_of(Petstore::ClassModel)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "_class"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,21 @@ require 'date'
|
||||
# Unit tests for Petstore::Client
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::Client do
|
||||
let(:instance) { Petstore::Client.new }
|
||||
describe 'Client' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::Client.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of Client' do
|
||||
it 'should create an instance of Client' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::Client)
|
||||
expect(@instance).to be_instance_of(Petstore::Client)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "client"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.2.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -22,11 +22,9 @@ describe Petstore::DeprecatedObject do
|
||||
|
||||
describe 'test an instance of DeprecatedObject' do
|
||||
it 'should create an instance of DeprecatedObject' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::DeprecatedObject)
|
||||
expect(instance).to be_instance_of(Petstore::DeprecatedObject)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "name"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,21 @@ require 'date'
|
||||
# Unit tests for Petstore::Dog
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::Dog do
|
||||
let(:instance) { Petstore::Dog.new }
|
||||
describe 'Dog' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::Dog.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of Dog' do
|
||||
it 'should create an instance of Dog' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::Dog)
|
||||
expect(@instance).to be_instance_of(Petstore::Dog)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "breed"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,22 +17,27 @@ require 'date'
|
||||
# Unit tests for Petstore::EnumArrays
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::EnumArrays do
|
||||
let(:instance) { Petstore::EnumArrays.new }
|
||||
describe 'EnumArrays' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::EnumArrays.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of EnumArrays' do
|
||||
it 'should create an instance of EnumArrays' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::EnumArrays)
|
||||
expect(@instance).to be_instance_of(Petstore::EnumArrays)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "just_symbol"' 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', [">=", "$"])
|
||||
# validator.allowable_values.each do |value|
|
||||
# expect { instance.just_symbol = value }.not_to raise_error
|
||||
# expect { @instance.just_symbol = value }.not_to raise_error
|
||||
# end
|
||||
end
|
||||
end
|
||||
@ -42,7 +47,7 @@ describe Petstore::EnumArrays do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
# validator = Petstore::EnumTest::EnumAttributeValidator.new('Array<String>', ["fish", "crab"])
|
||||
# validator.allowable_values.each do |value|
|
||||
# expect { instance.array_enum = value }.not_to raise_error
|
||||
# expect { @instance.array_enum = value }.not_to raise_error
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,14 +17,19 @@ require 'date'
|
||||
# Unit tests for Petstore::EnumClass
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::EnumClass do
|
||||
let(:instance) { Petstore::EnumClass.new }
|
||||
describe 'EnumClass' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::EnumClass.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of EnumClass' do
|
||||
it 'should create an instance of EnumClass' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::EnumClass)
|
||||
expect(@instance).to be_instance_of(Petstore::EnumClass)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,22 +17,27 @@ require 'date'
|
||||
# Unit tests for Petstore::EnumTest
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::EnumTest do
|
||||
let(:instance) { Petstore::EnumTest.new }
|
||||
describe 'EnumTest' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::EnumTest.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of EnumTest' do
|
||||
it 'should create an instance of EnumTest' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::EnumTest)
|
||||
expect(@instance).to be_instance_of(Petstore::EnumTest)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "enum_string"' 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', ["UPPER", "lower", ""])
|
||||
# validator.allowable_values.each do |value|
|
||||
# expect { instance.enum_string = value }.not_to raise_error
|
||||
# expect { @instance.enum_string = value }.not_to raise_error
|
||||
# end
|
||||
end
|
||||
end
|
||||
@ -42,7 +47,7 @@ describe Petstore::EnumTest do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["UPPER", "lower", ""])
|
||||
# validator.allowable_values.each do |value|
|
||||
# expect { instance.enum_string_required = value }.not_to raise_error
|
||||
# expect { @instance.enum_string_required = value }.not_to raise_error
|
||||
# end
|
||||
end
|
||||
end
|
||||
@ -52,7 +57,7 @@ describe Petstore::EnumTest do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
# validator = Petstore::EnumTest::EnumAttributeValidator.new('Integer', [1, -1])
|
||||
# validator.allowable_values.each do |value|
|
||||
# expect { instance.enum_integer = value }.not_to raise_error
|
||||
# expect { @instance.enum_integer = value }.not_to raise_error
|
||||
# end
|
||||
end
|
||||
end
|
||||
@ -62,7 +67,7 @@ describe Petstore::EnumTest do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
# validator = Petstore::EnumTest::EnumAttributeValidator.new('Float', [1.1, -1.2])
|
||||
# validator.allowable_values.each do |value|
|
||||
# expect { instance.enum_number = value }.not_to raise_error
|
||||
# expect { @instance.enum_number = value }.not_to raise_error
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 7.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -22,11 +22,9 @@ describe Petstore::FakeBigDecimalMap200Response do
|
||||
|
||||
describe 'test an instance of FakeBigDecimalMap200Response' do
|
||||
it 'should create an instance of FakeBigDecimalMap200Response' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::FakeBigDecimalMap200Response)
|
||||
expect(instance).to be_instance_of(Petstore::FakeBigDecimalMap200Response)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "some_id"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,21 @@ require 'date'
|
||||
# Unit tests for Petstore::FileSchemaTestClass
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::FileSchemaTestClass do
|
||||
let(:instance) { Petstore::FileSchemaTestClass.new }
|
||||
describe 'FileSchemaTestClass' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::FileSchemaTestClass.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of FileSchemaTestClass' do
|
||||
it 'should create an instance of FileSchemaTestClass' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::FileSchemaTestClass)
|
||||
expect(@instance).to be_instance_of(Petstore::FileSchemaTestClass)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "file"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,21 @@ require 'date'
|
||||
# Unit tests for Petstore::File
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::File do
|
||||
let(:instance) { Petstore::File.new }
|
||||
describe 'File' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::File.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of File' do
|
||||
it 'should create an instance of File' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::File)
|
||||
expect(@instance).to be_instance_of(Petstore::File)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "source_uri"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 6.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -22,11 +22,9 @@ describe Petstore::FooGetDefaultResponse do
|
||||
|
||||
describe 'test an instance of FooGetDefaultResponse' do
|
||||
it 'should create an instance of FooGetDefaultResponse' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::FooGetDefaultResponse)
|
||||
expect(instance).to be_instance_of(Petstore::FooGetDefaultResponse)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "string"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,21 @@ require 'date'
|
||||
# Unit tests for Petstore::Foo
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::Foo do
|
||||
let(:instance) { Petstore::Foo.new }
|
||||
describe 'Foo' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::Foo.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of Foo' do
|
||||
it 'should create an instance of Foo' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::Foo)
|
||||
expect(@instance).to be_instance_of(Petstore::Foo)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "bar"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,26 @@ require 'date'
|
||||
# Unit tests for Petstore::FormatTest
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::FormatTest do
|
||||
let(:instance) { Petstore::FormatTest.new }
|
||||
describe 'FormatTest' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::FormatTest.new({
|
||||
number: 65,
|
||||
byte: '1234356',
|
||||
date: Date.parse('2007-12-03T10:15:30+01:00'),
|
||||
password: 'password123'
|
||||
})
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of FormatTest' do
|
||||
it 'should create an instance of FormatTest' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::FormatTest)
|
||||
expect(@instance).to be_instance_of(Petstore::FormatTest)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "integer"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
@ -63,12 +73,6 @@ describe Petstore::FormatTest do
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "decimal"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "string"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,21 @@ require 'date'
|
||||
# Unit tests for Petstore::HasOnlyReadOnly
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::HasOnlyReadOnly do
|
||||
let(:instance) { Petstore::HasOnlyReadOnly.new }
|
||||
describe 'HasOnlyReadOnly' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::HasOnlyReadOnly.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of HasOnlyReadOnly' do
|
||||
it 'should create an instance of HasOnlyReadOnly' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::HasOnlyReadOnly)
|
||||
expect(@instance).to be_instance_of(Petstore::HasOnlyReadOnly)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "bar"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,21 @@ require 'date'
|
||||
# Unit tests for Petstore::HealthCheckResult
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::HealthCheckResult do
|
||||
let(:instance) { Petstore::HealthCheckResult.new }
|
||||
describe 'HealthCheckResult' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::HealthCheckResult.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of HealthCheckResult' do
|
||||
it 'should create an instance of HealthCheckResult' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::HealthCheckResult)
|
||||
expect(@instance).to be_instance_of(Petstore::HealthCheckResult)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "nullable_message"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,21 @@ require 'date'
|
||||
# Unit tests for Petstore::List
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::List do
|
||||
let(:instance) { Petstore::List.new }
|
||||
describe 'List' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::List.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of List' do
|
||||
it 'should create an instance of List' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::List)
|
||||
expect(@instance).to be_instance_of(Petstore::List)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "_123_list"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -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
|
||||
OpenAPI Generator version: 7.0.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,37 @@
|
||||
=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
|
||||
OpenAPI Generator version: 7.0.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
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,31 @@
|
||||
=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
|
||||
OpenAPI Generator version: 7.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'spec_helper'
|
||||
require 'json'
|
||||
require 'date'
|
||||
|
||||
# Unit tests for Petstore::MammalWithoutDiscriminator
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
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 '.build' do
|
||||
it 'returns the correct model' do
|
||||
end
|
||||
end
|
||||
end
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,21 @@ require 'date'
|
||||
# Unit tests for Petstore::MapTest
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::MapTest do
|
||||
let(:instance) { Petstore::MapTest.new }
|
||||
describe 'MapTest' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::MapTest.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of MapTest' do
|
||||
it 'should create an instance of MapTest' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::MapTest)
|
||||
expect(@instance).to be_instance_of(Petstore::MapTest)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "map_map_of_string"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
@ -38,7 +43,7 @@ describe Petstore::MapTest do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
# validator = Petstore::EnumTest::EnumAttributeValidator.new('Hash<String, String>', ["UPPER", "lower"])
|
||||
# validator.allowable_values.each do |value|
|
||||
# expect { instance.map_of_enum_string = value }.not_to raise_error
|
||||
# expect { @instance.map_of_enum_string = value }.not_to raise_error
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,21 @@ require 'date'
|
||||
# Unit tests for Petstore::MixedPropertiesAndAdditionalPropertiesClass
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::MixedPropertiesAndAdditionalPropertiesClass do
|
||||
let(:instance) { Petstore::MixedPropertiesAndAdditionalPropertiesClass.new }
|
||||
describe 'MixedPropertiesAndAdditionalPropertiesClass' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::MixedPropertiesAndAdditionalPropertiesClass.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of MixedPropertiesAndAdditionalPropertiesClass' do
|
||||
it 'should create an instance of MixedPropertiesAndAdditionalPropertiesClass' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::MixedPropertiesAndAdditionalPropertiesClass)
|
||||
expect(@instance).to be_instance_of(Petstore::MixedPropertiesAndAdditionalPropertiesClass)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "uuid"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,21 @@ require 'date'
|
||||
# Unit tests for Petstore::Model200Response
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::Model200Response do
|
||||
let(:instance) { Petstore::Model200Response.new }
|
||||
describe 'Model200Response' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::Model200Response.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of Model200Response' do
|
||||
it 'should create an instance of Model200Response' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::Model200Response)
|
||||
expect(@instance).to be_instance_of(Petstore::Model200Response)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "name"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,21 @@ require 'date'
|
||||
# Unit tests for Petstore::ModelReturn
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::ModelReturn do
|
||||
let(:instance) { Petstore::ModelReturn.new }
|
||||
describe 'ModelReturn' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::ModelReturn.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of ModelReturn' do
|
||||
it 'should create an instance of ModelReturn' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::ModelReturn)
|
||||
expect(@instance).to be_instance_of(Petstore::ModelReturn)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "_return"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,21 @@ require 'date'
|
||||
# Unit tests for Petstore::Name
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::Name do
|
||||
let(:instance) { Petstore::Name.new }
|
||||
describe 'Name' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::Name.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of Name' do
|
||||
it 'should create an instance of Name' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::Name)
|
||||
expect(@instance).to be_instance_of(Petstore::Name)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "name"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,21 @@ require 'date'
|
||||
# Unit tests for Petstore::NullableClass
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::NullableClass do
|
||||
let(:instance) { Petstore::NullableClass.new }
|
||||
describe 'NullableClass' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::NullableClass.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of NullableClass' do
|
||||
it 'should create an instance of NullableClass' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::NullableClass)
|
||||
expect(@instance).to be_instance_of(Petstore::NullableClass)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "integer_prop"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,21 @@ require 'date'
|
||||
# Unit tests for Petstore::NumberOnly
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::NumberOnly do
|
||||
let(:instance) { Petstore::NumberOnly.new }
|
||||
describe 'NumberOnly' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::NumberOnly.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of NumberOnly' do
|
||||
it 'should create an instance of NumberOnly' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::NumberOnly)
|
||||
expect(@instance).to be_instance_of(Petstore::NumberOnly)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "just_number"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.2.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -22,11 +22,9 @@ describe Petstore::ObjectWithDeprecatedFields do
|
||||
|
||||
describe 'test an instance of ObjectWithDeprecatedFields' do
|
||||
it 'should create an instance of ObjectWithDeprecatedFields' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::ObjectWithDeprecatedFields)
|
||||
expect(instance).to be_instance_of(Petstore::ObjectWithDeprecatedFields)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "uuid"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,21 @@ require 'date'
|
||||
# Unit tests for Petstore::Order
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::Order do
|
||||
let(:instance) { Petstore::Order.new }
|
||||
describe 'Order' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::Order.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of Order' do
|
||||
it 'should create an instance of Order' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::Order)
|
||||
expect(@instance).to be_instance_of(Petstore::Order)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "id"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
@ -56,7 +61,7 @@ describe Petstore::Order do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["placed", "approved", "delivered"])
|
||||
# validator.allowable_values.each do |value|
|
||||
# expect { instance.status = value }.not_to raise_error
|
||||
# expect { @instance.status = value }.not_to raise_error
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,21 @@ require 'date'
|
||||
# Unit tests for Petstore::OuterComposite
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::OuterComposite do
|
||||
let(:instance) { Petstore::OuterComposite.new }
|
||||
describe 'OuterComposite' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::OuterComposite.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of OuterComposite' do
|
||||
it 'should create an instance of OuterComposite' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::OuterComposite)
|
||||
expect(@instance).to be_instance_of(Petstore::OuterComposite)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "my_number"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,14 +17,19 @@ require 'date'
|
||||
# Unit tests for Petstore::OuterEnumDefaultValue
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::OuterEnumDefaultValue do
|
||||
let(:instance) { Petstore::OuterEnumDefaultValue.new }
|
||||
describe 'OuterEnumDefaultValue' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::OuterEnumDefaultValue.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of OuterEnumDefaultValue' do
|
||||
it 'should create an instance of OuterEnumDefaultValue' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::OuterEnumDefaultValue)
|
||||
expect(@instance).to be_instance_of(Petstore::OuterEnumDefaultValue)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,14 +17,19 @@ require 'date'
|
||||
# Unit tests for Petstore::OuterEnumIntegerDefaultValue
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::OuterEnumIntegerDefaultValue do
|
||||
let(:instance) { Petstore::OuterEnumIntegerDefaultValue.new }
|
||||
describe 'OuterEnumIntegerDefaultValue' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::OuterEnumIntegerDefaultValue.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of OuterEnumIntegerDefaultValue' do
|
||||
it 'should create an instance of OuterEnumIntegerDefaultValue' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::OuterEnumIntegerDefaultValue)
|
||||
expect(@instance).to be_instance_of(Petstore::OuterEnumIntegerDefaultValue)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,14 +17,19 @@ require 'date'
|
||||
# Unit tests for Petstore::OuterEnumInteger
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::OuterEnumInteger do
|
||||
let(:instance) { Petstore::OuterEnumInteger.new }
|
||||
describe 'OuterEnumInteger' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::OuterEnumInteger.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of OuterEnumInteger' do
|
||||
it 'should create an instance of OuterEnumInteger' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::OuterEnumInteger)
|
||||
expect(@instance).to be_instance_of(Petstore::OuterEnumInteger)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,14 +17,19 @@ require 'date'
|
||||
# Unit tests for Petstore::OuterEnum
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::OuterEnum do
|
||||
let(:instance) { Petstore::OuterEnum.new }
|
||||
describe 'OuterEnum' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::OuterEnum.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of OuterEnum' do
|
||||
it 'should create an instance of OuterEnum' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::OuterEnum)
|
||||
expect(@instance).to be_instance_of(Petstore::OuterEnum)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -22,11 +22,9 @@ describe Petstore::OuterObjectWithEnumProperty do
|
||||
|
||||
describe 'test an instance of OuterObjectWithEnumProperty' do
|
||||
it 'should create an instance of OuterObjectWithEnumProperty' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::OuterObjectWithEnumProperty)
|
||||
expect(instance).to be_instance_of(Petstore::OuterObjectWithEnumProperty)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "value"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
|
@ -6,7 +6,7 @@
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
||||
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,16 +17,21 @@ require 'date'
|
||||
# Unit tests for Petstore::Pet
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe Petstore::Pet do
|
||||
let(:instance) { Petstore::Pet.new }
|
||||
describe 'Pet' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::Pet.new({ name: 'Kitty', photo_urls: ['www.photo-url.test'] })
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of Pet' do
|
||||
it 'should create an instance of Pet' do
|
||||
# uncomment below to test the instance creation
|
||||
#expect(instance).to be_instance_of(Petstore::Pet)
|
||||
expect(@instance).to be_instance_of(Petstore::Pet)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "id"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
@ -62,7 +67,7 @@ describe Petstore::Pet do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["available", "pending", "sold"])
|
||||
# validator.allowable_values.each do |value|
|
||||
# expect { instance.status = value }.not_to raise_error
|
||||
# expect { @instance.status = value }.not_to raise_error
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
@ -0,0 +1,52 @@
|
||||
=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
|
||||
OpenAPI Generator version: 7.0.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
|
||||
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 "underscore_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_with_underscore"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
||||
end
|
||||
end
|
||||
|
||||
end
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user