migrate ruby samples to oas3 (#6414)

This commit is contained in:
William Cheng 2020-05-25 23:02:30 +08:00 committed by GitHub
parent f4897ea4a4
commit db4c4917e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
572 changed files with 1442 additions and 45622 deletions

View File

@ -1,43 +0,0 @@
#!/bin/sh
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn clean package
fi
# purge lib/doc folder
echo "purge ruby petstore lib, docs folder"
rm -Rf samples/openapi3/client/petstore/ruby-faraday/lib
rm -Rf samples/openapi3/client/petstore/ruby-faraday/docs
# purge test files other than integration test
# NOTE: spec/custom/*.rb and spec/petstore_helper.rb are not generated files
echo "purge ruby petstore spec"
find samples/openapi3/client/petstore/ruby-faraday/spec -type d -not -name spec -not -name custom | xargs rm -Rf
find samples/openapi3/client/petstore/ruby-faraday/spec -type f -not -name petstore_helper.rb -not -iwholename '*/spec/custom/*' | xargs rm -Rf
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/ruby-client -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ruby -c bin/openapi3/ruby-petstore-faraday.json -o samples/openapi3/client/petstore/ruby-faraday --additional-properties skipFormModel=true $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -1,43 +0,0 @@
#!/bin/sh
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn clean package
fi
# purge lib/doc folder
echo "purge ruby petstore lib, docs folder"
rm -Rf samples/openapi3/client/petstore/ruby/lib
rm -Rf samples/openapi3/client/petstore/ruby/docs
# purge test files other than integration test
# NOTE: spec/custom/*.rb and spec/petstore_helper.rb are not generated files
echo "purge ruby petstore spec"
find samples/openapi3/client/petstore/ruby/spec -type d -not -name spec -not -name custom | xargs rm -Rf
find samples/openapi3/client/petstore/ruby/spec -type f -not -name petstore_helper.rb -not -iwholename '*/spec/custom/*' | xargs rm -Rf
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/ruby-client -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ruby -c bin/ruby-petstore.json -o samples/openapi3/client/petstore/ruby --additional-properties skipFormModel=true $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -1,32 +0,0 @@
#!/bin/sh
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn clean package
fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/ruby-on-rails-server -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g ruby-on-rails -o samples/server/petstore/ruby-on-rails $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -1,6 +0,0 @@
{
"gemName": "petstore",
"moduleName": "Petstore",
"library": "faraday",
"gemVersion": "1.0.0"
}

View File

@ -1,32 +0,0 @@
#!/bin/sh
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn clean package
fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/ruby-sinatra-server -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g ruby-sinatra -o samples/server/petstore/ruby-sinatra $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -22,11 +22,22 @@ executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn -B clean package
mvn clean package
fi
# purge lib/doc folder
echo "purge ruby petstore lib, docs folder"
rm -Rf samples/client/petstore/ruby-faraday/lib
rm -Rf samples/client/petstore/ruby-faraday/docs
# purge test files other than integration test
# NOTE: spec/custom/*.rb and spec/petstore_helper.rb are not generated files
echo "purge ruby petstore spec"
find samples/client/petstore/ruby-faraday/spec -type d -not -name spec -not -name custom | xargs rm -Rf
find samples/client/petstore/ruby-faraday/spec -type f -not -name petstore_helper.rb -not -iwholename '*/spec/custom/*' | xargs rm -Rf
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/ruby-client -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ruby -c bin/ruby-petstore-faraday.json -o samples/client/petstore/ruby-faraday $@"
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/ruby-client -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ruby -c bin/ruby-petstore-faraday.json -o samples/client/petstore/ruby-faraday --additional-properties skipFormModel=true $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -22,16 +22,22 @@ executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn -B clean package
mvn clean package
fi
echo "purge ruby petstore lib, docs, spec folder"
# purge lib/doc folder
echo "purge ruby petstore lib, docs folder"
rm -Rf samples/client/petstore/ruby/lib
rm -Rf samples/client/petstore/ruby/docs
rm -Rf samples/client/petstore/ruby/spec
# purge test files other than integration test
# NOTE: spec/custom/*.rb and spec/petstore_helper.rb are not generated files
echo "purge ruby petstore spec"
find samples/client/petstore/ruby/spec -type d -not -name spec -not -name custom | xargs rm -Rf
find samples/client/petstore/ruby/spec -type f -not -name petstore_helper.rb -not -iwholename '*/spec/custom/*' | xargs rm -Rf
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/ruby-client -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ruby -c bin/ruby-petstore.json -o samples/client/petstore/ruby $@"
ags="generate -t modules/openapi-generator/src/main/resources/ruby-client -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ruby -c bin/ruby-petstore.json -o samples/client/petstore/ruby --additional-properties skipFormModel=true $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -22,11 +22,11 @@ executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn -B clean package
mvn clean package
fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/ruby-on-rails-server -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g ruby-on-rails -o samples/server/petstore/ruby-on-rails $@"
ags="generate -t modules/openapi-generator/src/main/resources/ruby-on-rails-server -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g ruby-on-rails -o samples/server/petstore/ruby-on-rails $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -2,6 +2,5 @@
"gemName": "petstore",
"moduleName": "Petstore",
"library": "faraday",
"gemVersion": "1.0.0",
"strictSpecBehavior": false
"gemVersion": "1.0.0"
}

View File

@ -22,11 +22,11 @@ executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn -B clean package
mvn clean package
fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/ruby-sinatra-server -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g ruby-sinatra -o samples/server/petstore/ruby-sinatra $@"
ags="generate -t modules/openapi-generator/src/main/resources/ruby-sinatra-server -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g ruby-sinatra -o samples/server/petstore/ruby-sinatra $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -24,8 +24,6 @@ sleep 5
declare -a samples=(
"${root}/bin/ruby-client-petstore.sh"
"${root}/bin/ruby-client-petstore-faraday.sh"
"${root}/bin/openapi3/ruby-client-petstore.sh"
"${root}/bin/openapi3/ruby-client-faraday-petstore.sh"
"${root}/bin/java-petstore-all.sh"
"${root}/bin/java-jaxrs-petstore-server-all.sh"
"${root}/bin/java-msf4j-petstore-server.sh"

View File

@ -1087,7 +1087,6 @@
<module>samples/client/petstore/python</module>
</modules>
</profile>
<!--
<profile>
<id>ruby-client</id>
<activation>
@ -1100,7 +1099,6 @@
<module>samples/client/petstore/ruby</module>
</modules>
</profile>
-->
<profile>
<id>go-client</id>
<activation>
@ -1387,7 +1385,7 @@
<module>samples/server/petstore/go-api-server</module>
<module>samples/server/petstore/go-gin-api-server</module>
<!-- clients -->
<module>samples/openapi3/client/petstore/ruby</module>
<module>samples/client/petstore/ruby</module>
<!-- test java-related projects -->
<module>samples/openapi3/client/petstore/scala-akka</module>
<module>samples/client/petstore/dart2/petstore</module>

View File

@ -5,28 +5,20 @@
Gemfile
README.md
Rakefile
docs/AdditionalPropertiesAnyType.md
docs/AdditionalPropertiesArray.md
docs/AdditionalPropertiesBoolean.md
docs/AdditionalPropertiesClass.md
docs/AdditionalPropertiesInteger.md
docs/AdditionalPropertiesNumber.md
docs/AdditionalPropertiesObject.md
docs/AdditionalPropertiesString.md
docs/Animal.md
docs/AnotherFakeApi.md
docs/ApiResponse.md
docs/ArrayOfArrayOfNumberOnly.md
docs/ArrayOfNumberOnly.md
docs/ArrayTest.md
docs/BigCat.md
docs/BigCatAllOf.md
docs/Capitalization.md
docs/Cat.md
docs/CatAllOf.md
docs/Category.md
docs/ClassModel.md
docs/Client.md
docs/DefaultApi.md
docs/Dog.md
docs/DogAllOf.md
docs/EnumArrays.md
@ -36,32 +28,43 @@ docs/FakeApi.md
docs/FakeClassnameTags123Api.md
docs/File.md
docs/FileSchemaTestClass.md
docs/Foo.md
docs/FormatTest.md
docs/HasOnlyReadOnly.md
docs/HealthCheckResult.md
docs/InlineObject.md
docs/InlineObject1.md
docs/InlineObject2.md
docs/InlineObject3.md
docs/InlineObject4.md
docs/InlineObject5.md
docs/InlineResponseDefault.md
docs/List.md
docs/MapTest.md
docs/MixedPropertiesAndAdditionalPropertiesClass.md
docs/Model200Response.md
docs/ModelReturn.md
docs/Name.md
docs/NullableClass.md
docs/NumberOnly.md
docs/Order.md
docs/OuterComposite.md
docs/OuterEnum.md
docs/OuterEnumDefaultValue.md
docs/OuterEnumInteger.md
docs/OuterEnumIntegerDefaultValue.md
docs/Pet.md
docs/PetApi.md
docs/ReadOnlyFirst.md
docs/SpecialModelName.md
docs/StoreApi.md
docs/Tag.md
docs/TypeHolderDefault.md
docs/TypeHolderExample.md
docs/User.md
docs/UserApi.md
docs/XmlItem.md
git_push.sh
lib/petstore.rb
lib/petstore/api/another_fake_api.rb
lib/petstore/api/default_api.rb
lib/petstore/api/fake_api.rb
lib/petstore/api/fake_classname_tags123_api.rb
lib/petstore/api/pet_api.rb
@ -71,21 +74,12 @@ lib/petstore/api_client.rb
lib/petstore/api_error.rb
lib/petstore/configuration.rb
lib/petstore/configuration.rb
lib/petstore/models/additional_properties_any_type.rb
lib/petstore/models/additional_properties_array.rb
lib/petstore/models/additional_properties_boolean.rb
lib/petstore/models/additional_properties_class.rb
lib/petstore/models/additional_properties_integer.rb
lib/petstore/models/additional_properties_number.rb
lib/petstore/models/additional_properties_object.rb
lib/petstore/models/additional_properties_string.rb
lib/petstore/models/animal.rb
lib/petstore/models/api_response.rb
lib/petstore/models/array_of_array_of_number_only.rb
lib/petstore/models/array_of_number_only.rb
lib/petstore/models/array_test.rb
lib/petstore/models/big_cat.rb
lib/petstore/models/big_cat_all_of.rb
lib/petstore/models/capitalization.rb
lib/petstore/models/cat.rb
lib/petstore/models/cat_all_of.rb
@ -99,28 +93,94 @@ lib/petstore/models/enum_class.rb
lib/petstore/models/enum_test.rb
lib/petstore/models/file.rb
lib/petstore/models/file_schema_test_class.rb
lib/petstore/models/foo.rb
lib/petstore/models/format_test.rb
lib/petstore/models/has_only_read_only.rb
lib/petstore/models/health_check_result.rb
lib/petstore/models/inline_object.rb
lib/petstore/models/inline_object1.rb
lib/petstore/models/inline_object2.rb
lib/petstore/models/inline_object3.rb
lib/petstore/models/inline_object4.rb
lib/petstore/models/inline_object5.rb
lib/petstore/models/inline_response_default.rb
lib/petstore/models/list.rb
lib/petstore/models/map_test.rb
lib/petstore/models/mixed_properties_and_additional_properties_class.rb
lib/petstore/models/model200_response.rb
lib/petstore/models/model_return.rb
lib/petstore/models/name.rb
lib/petstore/models/nullable_class.rb
lib/petstore/models/number_only.rb
lib/petstore/models/order.rb
lib/petstore/models/outer_composite.rb
lib/petstore/models/outer_enum.rb
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/pet.rb
lib/petstore/models/read_only_first.rb
lib/petstore/models/special_model_name.rb
lib/petstore/models/tag.rb
lib/petstore/models/type_holder_default.rb
lib/petstore/models/type_holder_example.rb
lib/petstore/models/user.rb
lib/petstore/models/xml_item.rb
lib/petstore/version.rb
petstore.gemspec
spec/api/another_fake_api_spec.rb
spec/api/default_api_spec.rb
spec/api/fake_api_spec.rb
spec/api/fake_classname_tags123_api_spec.rb
spec/api/pet_api_spec.rb
spec/api/store_api_spec.rb
spec/api/user_api_spec.rb
spec/api_client_spec.rb
spec/configuration_spec.rb
spec/models/additional_properties_class_spec.rb
spec/models/animal_spec.rb
spec/models/api_response_spec.rb
spec/models/array_of_array_of_number_only_spec.rb
spec/models/array_of_number_only_spec.rb
spec/models/array_test_spec.rb
spec/models/capitalization_spec.rb
spec/models/cat_all_of_spec.rb
spec/models/cat_spec.rb
spec/models/category_spec.rb
spec/models/class_model_spec.rb
spec/models/client_spec.rb
spec/models/dog_all_of_spec.rb
spec/models/dog_spec.rb
spec/models/enum_arrays_spec.rb
spec/models/enum_class_spec.rb
spec/models/enum_test_spec.rb
spec/models/file_schema_test_class_spec.rb
spec/models/file_spec.rb
spec/models/foo_spec.rb
spec/models/format_test_spec.rb
spec/models/has_only_read_only_spec.rb
spec/models/health_check_result_spec.rb
spec/models/inline_object1_spec.rb
spec/models/inline_object2_spec.rb
spec/models/inline_object3_spec.rb
spec/models/inline_object4_spec.rb
spec/models/inline_object5_spec.rb
spec/models/inline_object_spec.rb
spec/models/inline_response_default_spec.rb
spec/models/list_spec.rb
spec/models/map_test_spec.rb
spec/models/mixed_properties_and_additional_properties_class_spec.rb
spec/models/model200_response_spec.rb
spec/models/model_return_spec.rb
spec/models/name_spec.rb
spec/models/nullable_class_spec.rb
spec/models/number_only_spec.rb
spec/models/order_spec.rb
spec/models/outer_composite_spec.rb
spec/models/outer_enum_default_value_spec.rb
spec/models/outer_enum_integer_default_value_spec.rb
spec/models/outer_enum_integer_spec.rb
spec/models/outer_enum_spec.rb
spec/models/pet_spec.rb
spec/models/read_only_first_spec.rb
spec/models/special_model_name_spec.rb
spec/models/tag_spec.rb
spec/models/user_spec.rb
spec/spec_helper.rb

View File

@ -57,11 +57,11 @@ Please follow the [installation](#installation) procedure and then run the follo
require 'petstore'
api_instance = Petstore::AnotherFakeApi.new
body = Petstore::Client.new # Client | client model
client = Petstore::Client.new # Client | client model
begin
#To test special tags
result = api_instance.call_123_test_special_tags(body)
result = api_instance.call_123_test_special_tags(client)
p result
rescue Petstore::ApiError => e
puts "Exception when calling AnotherFakeApi->call_123_test_special_tags: #{e}"
@ -76,7 +76,9 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*Petstore::AnotherFakeApi* | [**call_123_test_special_tags**](docs/AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags
*Petstore::FakeApi* | [**create_xml_item**](docs/FakeApi.md#create_xml_item) | **POST** /fake/create_xml_item | creates an XmlItem
*Petstore::DefaultApi* | [**foo_get**](docs/DefaultApi.md#foo_get) | **GET** /foo |
*Petstore::FakeApi* | [**fake_health_get**](docs/FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint
*Petstore::FakeApi* | [**fake_http_signature_test**](docs/FakeApi.md#fake_http_signature_test) | **GET** /fake/http-signature-test | test http signature authentication
*Petstore::FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean |
*Petstore::FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite |
*Petstore::FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number |
@ -116,21 +118,12 @@ Class | Method | HTTP request | Description
## Documentation for Models
- [Petstore::AdditionalPropertiesAnyType](docs/AdditionalPropertiesAnyType.md)
- [Petstore::AdditionalPropertiesArray](docs/AdditionalPropertiesArray.md)
- [Petstore::AdditionalPropertiesBoolean](docs/AdditionalPropertiesBoolean.md)
- [Petstore::AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
- [Petstore::AdditionalPropertiesInteger](docs/AdditionalPropertiesInteger.md)
- [Petstore::AdditionalPropertiesNumber](docs/AdditionalPropertiesNumber.md)
- [Petstore::AdditionalPropertiesObject](docs/AdditionalPropertiesObject.md)
- [Petstore::AdditionalPropertiesString](docs/AdditionalPropertiesString.md)
- [Petstore::Animal](docs/Animal.md)
- [Petstore::ApiResponse](docs/ApiResponse.md)
- [Petstore::ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
- [Petstore::ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
- [Petstore::ArrayTest](docs/ArrayTest.md)
- [Petstore::BigCat](docs/BigCat.md)
- [Petstore::BigCatAllOf](docs/BigCatAllOf.md)
- [Petstore::Capitalization](docs/Capitalization.md)
- [Petstore::Cat](docs/Cat.md)
- [Petstore::CatAllOf](docs/CatAllOf.md)
@ -144,26 +137,36 @@ Class | Method | HTTP request | Description
- [Petstore::EnumTest](docs/EnumTest.md)
- [Petstore::File](docs/File.md)
- [Petstore::FileSchemaTestClass](docs/FileSchemaTestClass.md)
- [Petstore::Foo](docs/Foo.md)
- [Petstore::FormatTest](docs/FormatTest.md)
- [Petstore::HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
- [Petstore::HealthCheckResult](docs/HealthCheckResult.md)
- [Petstore::InlineObject](docs/InlineObject.md)
- [Petstore::InlineObject1](docs/InlineObject1.md)
- [Petstore::InlineObject2](docs/InlineObject2.md)
- [Petstore::InlineObject3](docs/InlineObject3.md)
- [Petstore::InlineObject4](docs/InlineObject4.md)
- [Petstore::InlineObject5](docs/InlineObject5.md)
- [Petstore::InlineResponseDefault](docs/InlineResponseDefault.md)
- [Petstore::List](docs/List.md)
- [Petstore::MapTest](docs/MapTest.md)
- [Petstore::MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
- [Petstore::Model200Response](docs/Model200Response.md)
- [Petstore::ModelReturn](docs/ModelReturn.md)
- [Petstore::Name](docs/Name.md)
- [Petstore::NullableClass](docs/NullableClass.md)
- [Petstore::NumberOnly](docs/NumberOnly.md)
- [Petstore::Order](docs/Order.md)
- [Petstore::OuterComposite](docs/OuterComposite.md)
- [Petstore::OuterEnum](docs/OuterEnum.md)
- [Petstore::OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md)
- [Petstore::OuterEnumInteger](docs/OuterEnumInteger.md)
- [Petstore::OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md)
- [Petstore::Pet](docs/Pet.md)
- [Petstore::ReadOnlyFirst](docs/ReadOnlyFirst.md)
- [Petstore::SpecialModelName](docs/SpecialModelName.md)
- [Petstore::Tag](docs/Tag.md)
- [Petstore::TypeHolderDefault](docs/TypeHolderDefault.md)
- [Petstore::TypeHolderExample](docs/TypeHolderExample.md)
- [Petstore::User](docs/User.md)
- [Petstore::XmlItem](docs/XmlItem.md)
## Documentation for Authorization
@ -183,10 +186,17 @@ Class | Method | HTTP request | Description
- **API key parameter name**: api_key_query
- **Location**: URL query string
### bearer_test
- **Type**: Bearer authentication (JWT)
### http_basic_test
- **Type**: HTTP basic authentication
### http_signature_test
### petstore_auth

View File

@ -1,17 +0,0 @@
# Petstore::AdditionalPropertiesAnyType
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **String** | | [optional]
## Code Sample
```ruby
require 'Petstore'
instance = Petstore::AdditionalPropertiesAnyType.new(name: null)
```

View File

@ -1,17 +0,0 @@
# Petstore::AdditionalPropertiesArray
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **String** | | [optional]
## Code Sample
```ruby
require 'Petstore'
instance = Petstore::AdditionalPropertiesArray.new(name: null)
```

View File

@ -1,17 +0,0 @@
# Petstore::AdditionalPropertiesBoolean
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **String** | | [optional]
## Code Sample
```ruby
require 'Petstore'
instance = Petstore::AdditionalPropertiesBoolean.new(name: null)
```

View File

@ -4,34 +4,16 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**map_string** | **Hash&lt;String, String&gt;** | | [optional]
**map_number** | **Hash&lt;String, Float&gt;** | | [optional]
**map_integer** | **Hash&lt;String, Integer&gt;** | | [optional]
**map_boolean** | **Hash&lt;String, Boolean&gt;** | | [optional]
**map_array_integer** | **Hash&lt;String, Array&lt;Integer&gt;&gt;** | | [optional]
**map_array_anytype** | **Hash&lt;String, Array&lt;Object&gt;&gt;** | | [optional]
**map_map_string** | **Hash&lt;String, Hash&lt;String, String&gt;&gt;** | | [optional]
**map_map_anytype** | **Hash&lt;String, Hash&lt;String, Object&gt;&gt;** | | [optional]
**anytype_1** | **Object** | | [optional]
**anytype_2** | **Object** | | [optional]
**anytype_3** | **Object** | | [optional]
**map_property** | **Hash&lt;String, String&gt;** | | [optional]
**map_of_map_property** | **Hash&lt;String, Hash&lt;String, String&gt;&gt;** | | [optional]
## Code Sample
```ruby
require 'Petstore'
instance = Petstore::AdditionalPropertiesClass.new(map_string: null,
map_number: null,
map_integer: null,
map_boolean: null,
map_array_integer: null,
map_array_anytype: null,
map_map_string: null,
map_map_anytype: null,
anytype_1: null,
anytype_2: null,
anytype_3: null)
instance = Petstore::AdditionalPropertiesClass.new(map_property: null,
map_of_map_property: null)
```

View File

@ -1,17 +0,0 @@
# Petstore::AdditionalPropertiesInteger
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **String** | | [optional]
## Code Sample
```ruby
require 'Petstore'
instance = Petstore::AdditionalPropertiesInteger.new(name: null)
```

View File

@ -1,17 +0,0 @@
# Petstore::AdditionalPropertiesNumber
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **String** | | [optional]
## Code Sample
```ruby
require 'Petstore'
instance = Petstore::AdditionalPropertiesNumber.new(name: null)
```

View File

@ -1,17 +0,0 @@
# Petstore::AdditionalPropertiesObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **String** | | [optional]
## Code Sample
```ruby
require 'Petstore'
instance = Petstore::AdditionalPropertiesObject.new(name: null)
```

View File

@ -1,17 +0,0 @@
# Petstore::AdditionalPropertiesString
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **String** | | [optional]
## Code Sample
```ruby
require 'Petstore'
instance = Petstore::AdditionalPropertiesString.new(name: null)
```

View File

@ -10,7 +10,7 @@ Method | HTTP request | Description
## call_123_test_special_tags
> Client call_123_test_special_tags(body)
> Client call_123_test_special_tags(client)
To test special tags
@ -23,11 +23,11 @@ To test special tags and operation ID starting with number
require 'petstore'
api_instance = Petstore::AnotherFakeApi.new
body = Petstore::Client.new # Client | client model
client = Petstore::Client.new # Client | client model
begin
#To test special tags
result = api_instance.call_123_test_special_tags(body)
result = api_instance.call_123_test_special_tags(client)
p result
rescue Petstore::ApiError => e
puts "Exception when calling AnotherFakeApi->call_123_test_special_tags: #{e}"
@ -39,7 +39,7 @@ end
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Client**](Client.md)| client model |
**client** | [**Client**](Client.md)| client model |
### Return type

View File

@ -1,17 +0,0 @@
# Petstore::BigCat
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**kind** | **String** | | [optional]
## Code Sample
```ruby
require 'Petstore'
instance = Petstore::BigCat.new(kind: null)
```

View File

@ -1,17 +0,0 @@
# Petstore::BigCatAllOf
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**kind** | **String** | | [optional]
## Code Sample
```ruby
require 'Petstore'
instance = Petstore::BigCatAllOf.new(kind: null)
```

View File

@ -9,6 +9,9 @@ Name | Type | Description | Notes
**enum_integer** | **Integer** | | [optional]
**enum_number** | **Float** | | [optional]
**outer_enum** | [**OuterEnum**](OuterEnum.md) | | [optional]
**outer_enum_integer** | [**OuterEnumInteger**](OuterEnumInteger.md) | | [optional]
**outer_enum_default_value** | [**OuterEnumDefaultValue**](OuterEnumDefaultValue.md) | | [optional]
**outer_enum_integer_default_value** | [**OuterEnumIntegerDefaultValue**](OuterEnumIntegerDefaultValue.md) | | [optional]
## Code Sample
@ -19,7 +22,10 @@ instance = Petstore::EnumTest.new(enum_string: null,
enum_string_required: null,
enum_integer: null,
enum_number: null,
outer_enum: null)
outer_enum: null,
outer_enum_integer: null,
outer_enum_default_value: null,
outer_enum_integer_default_value: null)
```

View File

@ -4,7 +4,8 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**create_xml_item**](FakeApi.md#create_xml_item) | **POST** /fake/create_xml_item | creates an XmlItem
[**fake_health_get**](FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint
[**fake_http_signature_test**](FakeApi.md#fake_http_signature_test) | **GET** /fake/http-signature-test | test http signature authentication
[**fake_outer_boolean_serialize**](FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean |
[**fake_outer_composite_serialize**](FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite |
[**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number |
@ -21,13 +22,11 @@ Method | HTTP request | Description
## create_xml_item
## fake_health_get
> create_xml_item(xml_item)
> HealthCheckResult fake_health_get
creates an XmlItem
this route creates an XmlItem
Health check endpoint
### Example
@ -36,13 +35,61 @@ this route creates an XmlItem
require 'petstore'
api_instance = Petstore::FakeApi.new
xml_item = Petstore::XmlItem.new # XmlItem | XmlItem Body
begin
#creates an XmlItem
api_instance.create_xml_item(xml_item)
#Health check endpoint
result = api_instance.fake_health_get
p result
rescue Petstore::ApiError => e
puts "Exception when calling FakeApi->create_xml_item: #{e}"
puts "Exception when calling FakeApi->fake_health_get: #{e}"
end
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**HealthCheckResult**](HealthCheckResult.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
## fake_http_signature_test
> fake_http_signature_test(pet, opts)
test http signature authentication
### Example
```ruby
# load the gem
require 'petstore'
# setup authorization
Petstore.configure do |config|
end
api_instance = Petstore::FakeApi.new
pet = Petstore::Pet.new # Pet | Pet object that needs to be added to the store
opts = {
query_1: 'query_1_example', # String | query parameter
header_1: 'header_1_example' # String | header parameter
}
begin
#test http signature authentication
api_instance.fake_http_signature_test(pet, opts)
rescue Petstore::ApiError => e
puts "Exception when calling FakeApi->fake_http_signature_test: #{e}"
end
```
@ -51,7 +98,9 @@ end
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**xml_item** | [**XmlItem**](XmlItem.md)| XmlItem Body |
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
**query_1** | **String**| query parameter | [optional]
**header_1** | **String**| header parameter | [optional]
### Return type
@ -59,11 +108,11 @@ nil (empty response body)
### Authorization
No authorization required
[http_signature_test](../README.md#http_signature_test)
### HTTP request headers
- **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16
- **Content-Type**: application/json, application/xml
- **Accept**: Not defined
@ -111,7 +160,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: */*
@ -131,7 +180,7 @@ require 'petstore'
api_instance = Petstore::FakeApi.new
opts = {
body: Petstore::OuterComposite.new # OuterComposite | Input composite as post body
outer_composite: Petstore::OuterComposite.new # OuterComposite | Input composite as post body
}
begin
@ -147,7 +196,7 @@ end
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional]
**outer_composite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional]
### Return type
@ -159,7 +208,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: */*
@ -207,7 +256,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: */*
@ -255,13 +304,13 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: */*
## test_body_with_file_schema
> test_body_with_file_schema(body)
> test_body_with_file_schema(file_schema_test_class)
@ -274,10 +323,10 @@ For this test, the body for this request much reference a schema named `File`.
require 'petstore'
api_instance = Petstore::FakeApi.new
body = Petstore::FileSchemaTestClass.new # FileSchemaTestClass |
file_schema_test_class = Petstore::FileSchemaTestClass.new # FileSchemaTestClass |
begin
api_instance.test_body_with_file_schema(body)
api_instance.test_body_with_file_schema(file_schema_test_class)
rescue Petstore::ApiError => e
puts "Exception when calling FakeApi->test_body_with_file_schema: #{e}"
end
@ -288,7 +337,7 @@ end
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| |
**file_schema_test_class** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| |
### Return type
@ -306,7 +355,7 @@ No authorization required
## test_body_with_query_params
> test_body_with_query_params(query, body)
> test_body_with_query_params(query, user)
@ -318,10 +367,10 @@ require 'petstore'
api_instance = Petstore::FakeApi.new
query = 'query_example' # String |
body = Petstore::User.new # User |
user = Petstore::User.new # User |
begin
api_instance.test_body_with_query_params(query, body)
api_instance.test_body_with_query_params(query, user)
rescue Petstore::ApiError => e
puts "Exception when calling FakeApi->test_body_with_query_params: #{e}"
end
@ -333,7 +382,7 @@ end
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**query** | **String**| |
**body** | [**User**](User.md)| |
**user** | [**User**](User.md)| |
### Return type
@ -351,7 +400,7 @@ No authorization required
## test_client_model
> Client test_client_model(body)
> Client test_client_model(client)
To test \"client\" model
@ -364,11 +413,11 @@ To test \"client\" model
require 'petstore'
api_instance = Petstore::FakeApi.new
body = Petstore::Client.new # Client | client model
client = Petstore::Client.new # Client | client model
begin
#To test \"client\" model
result = api_instance.test_client_model(body)
result = api_instance.test_client_model(client)
p result
rescue Petstore::ApiError => e
puts "Exception when calling FakeApi->test_client_model: #{e}"
@ -380,7 +429,7 @@ end
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Client**](Client.md)| client model |
**client** | [**Client**](Client.md)| client model |
### Return type
@ -551,6 +600,11 @@ Fake endpoint to test group parameters (optional)
```ruby
# load the gem
require 'petstore'
# setup authorization
Petstore.configure do |config|
# Configure Bearer authorization (JWT): bearer_test
config.access_token = 'YOUR_BEARER_TOKEN'
end
api_instance = Petstore::FakeApi.new
required_string_group = 56 # Integer | Required String in group parameters
@ -588,7 +642,7 @@ nil (empty response body)
### Authorization
No authorization required
[bearer_test](../README.md#bearer_test)
### HTTP request headers
@ -598,7 +652,7 @@ No authorization required
## test_inline_additional_properties
> test_inline_additional_properties(param)
> test_inline_additional_properties(request_body)
test inline additionalProperties
@ -609,11 +663,11 @@ test inline additionalProperties
require 'petstore'
api_instance = Petstore::FakeApi.new
param = {'key' => 'param_example'} # Hash<String, String> | request body
request_body = {'key' => 'request_body_example'} # Hash<String, String> | request body
begin
#test inline additionalProperties
api_instance.test_inline_additional_properties(param)
api_instance.test_inline_additional_properties(request_body)
rescue Petstore::ApiError => e
puts "Exception when calling FakeApi->test_inline_additional_properties: #{e}"
end
@ -624,7 +678,7 @@ end
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**param** | [**Hash&lt;String, String&gt;**](String.md)| request body |
**request_body** | [**Hash&lt;String, String&gt;**](String.md)| request body |
### Return type

View File

@ -10,7 +10,7 @@ Method | HTTP request | Description
## test_classname
> Client test_classname(body)
> Client test_classname(client)
To test class name in snake case
@ -30,11 +30,11 @@ Petstore.configure do |config|
end
api_instance = Petstore::FakeClassnameTags123Api.new
body = Petstore::Client.new # Client | client model
client = Petstore::Client.new # Client | client model
begin
#To test class name in snake case
result = api_instance.test_classname(body)
result = api_instance.test_classname(client)
p result
rescue Petstore::ApiError => e
puts "Exception when calling FakeClassnameTags123Api->test_classname: #{e}"
@ -46,7 +46,7 @@ end
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Client**](Client.md)| client model |
**client** | [**Client**](Client.md)| client model |
### Return type

View File

@ -17,7 +17,8 @@ Name | Type | Description | Notes
**date_time** | **DateTime** | | [optional]
**uuid** | **String** | | [optional]
**password** | **String** | |
**big_decimal** | [**BigDecimal**](BigDecimal.md) | | [optional]
**pattern_with_digits** | **String** | A string that is a 10 digit number. Can have leading zeros. | [optional]
**pattern_with_digits_and_delimiter** | **String** | A string starting with &#39;image_&#39; (case insensitive) and one to three digits following i.e. Image_01. | [optional]
## Code Sample
@ -37,7 +38,8 @@ instance = Petstore::FormatTest.new(integer: null,
date_time: null,
uuid: 72f98069-206d-4f12-9f12-3d1e525a8e84,
password: null,
big_decimal: null)
pattern_with_digits: null,
pattern_with_digits_and_delimiter: null)
```

View File

@ -18,7 +18,7 @@ Method | HTTP request | Description
## add_pet
> add_pet(body)
> add_pet(pet)
Add a new pet to the store
@ -34,11 +34,11 @@ Petstore.configure do |config|
end
api_instance = Petstore::PetApi.new
body = Petstore::Pet.new # Pet | Pet object that needs to be added to the store
pet = Petstore::Pet.new # Pet | Pet object that needs to be added to the store
begin
#Add a new pet to the store
api_instance.add_pet(body)
api_instance.add_pet(pet)
rescue Petstore::ApiError => e
puts "Exception when calling PetApi->add_pet: #{e}"
end
@ -49,7 +49,7 @@ end
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
### Return type
@ -278,7 +278,7 @@ Name | Type | Description | Notes
## update_pet
> update_pet(body)
> update_pet(pet)
Update an existing pet
@ -294,11 +294,11 @@ Petstore.configure do |config|
end
api_instance = Petstore::PetApi.new
body = Petstore::Pet.new # Pet | Pet object that needs to be added to the store
pet = Petstore::Pet.new # Pet | Pet object that needs to be added to the store
begin
#Update an existing pet
api_instance.update_pet(body)
api_instance.update_pet(pet)
rescue Petstore::ApiError => e
puts "Exception when calling PetApi->update_pet: #{e}"
end
@ -309,7 +309,7 @@ end
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
### Return type

View File

@ -156,7 +156,7 @@ No authorization required
## place_order
> Order place_order(body)
> Order place_order(order)
Place an order for a pet
@ -167,11 +167,11 @@ Place an order for a pet
require 'petstore'
api_instance = Petstore::StoreApi.new
body = Petstore::Order.new # Order | order placed for purchasing the pet
order = Petstore::Order.new # Order | order placed for purchasing the pet
begin
#Place an order for a pet
result = api_instance.place_order(body)
result = api_instance.place_order(order)
p result
rescue Petstore::ApiError => e
puts "Exception when calling StoreApi->place_order: #{e}"
@ -183,7 +183,7 @@ end
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Order**](Order.md)| order placed for purchasing the pet |
**order** | [**Order**](Order.md)| order placed for purchasing the pet |
### Return type
@ -195,6 +195,6 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: application/xml, application/json

View File

@ -1,25 +0,0 @@
# Petstore::TypeHolderDefault
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**string_item** | **String** | | [default to &#39;what&#39;]
**number_item** | **Float** | |
**integer_item** | **Integer** | |
**bool_item** | **Boolean** | | [default to true]
**array_item** | **Array&lt;Integer&gt;** | |
## Code Sample
```ruby
require 'Petstore'
instance = Petstore::TypeHolderDefault.new(string_item: null,
number_item: null,
integer_item: null,
bool_item: null,
array_item: null)
```

View File

@ -1,27 +0,0 @@
# Petstore::TypeHolderExample
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**string_item** | **String** | |
**number_item** | **Float** | |
**float_item** | **Float** | |
**integer_item** | **Integer** | |
**bool_item** | **Boolean** | |
**array_item** | **Array&lt;Integer&gt;** | |
## Code Sample
```ruby
require 'Petstore'
instance = Petstore::TypeHolderExample.new(string_item: what,
number_item: 1.234,
float_item: 1.234,
integer_item: -2,
bool_item: true,
array_item: [0, 1, 2, 3])
```

View File

@ -17,7 +17,7 @@ Method | HTTP request | Description
## create_user
> create_user(body)
> create_user(user)
Create user
@ -30,11 +30,11 @@ This can only be done by the logged in user.
require 'petstore'
api_instance = Petstore::UserApi.new
body = Petstore::User.new # User | Created user object
user = Petstore::User.new # User | Created user object
begin
#Create user
api_instance.create_user(body)
api_instance.create_user(user)
rescue Petstore::ApiError => e
puts "Exception when calling UserApi->create_user: #{e}"
end
@ -45,7 +45,7 @@ end
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**User**](User.md)| Created user object |
**user** | [**User**](User.md)| Created user object |
### Return type
@ -57,13 +57,13 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: Not defined
## create_users_with_array_input
> create_users_with_array_input(body)
> create_users_with_array_input(user)
Creates list of users with given input array
@ -74,11 +74,11 @@ Creates list of users with given input array
require 'petstore'
api_instance = Petstore::UserApi.new
body = [Petstore::User.new] # Array<User> | List of user object
user = [Petstore::User.new] # Array<User> | List of user object
begin
#Creates list of users with given input array
api_instance.create_users_with_array_input(body)
api_instance.create_users_with_array_input(user)
rescue Petstore::ApiError => e
puts "Exception when calling UserApi->create_users_with_array_input: #{e}"
end
@ -89,7 +89,7 @@ end
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Array&lt;User&gt;**](User.md)| List of user object |
**user** | [**Array&lt;User&gt;**](User.md)| List of user object |
### Return type
@ -101,13 +101,13 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: Not defined
## create_users_with_list_input
> create_users_with_list_input(body)
> create_users_with_list_input(user)
Creates list of users with given input array
@ -118,11 +118,11 @@ Creates list of users with given input array
require 'petstore'
api_instance = Petstore::UserApi.new
body = [Petstore::User.new] # Array<User> | List of user object
user = [Petstore::User.new] # Array<User> | List of user object
begin
#Creates list of users with given input array
api_instance.create_users_with_list_input(body)
api_instance.create_users_with_list_input(user)
rescue Petstore::ApiError => e
puts "Exception when calling UserApi->create_users_with_list_input: #{e}"
end
@ -133,7 +133,7 @@ end
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Array&lt;User&gt;**](User.md)| List of user object |
**user** | [**Array&lt;User&gt;**](User.md)| List of user object |
### Return type
@ -145,7 +145,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: Not defined
@ -329,7 +329,7 @@ No authorization required
## update_user
> update_user(username, body)
> update_user(username, user)
Updated user
@ -343,11 +343,11 @@ require 'petstore'
api_instance = Petstore::UserApi.new
username = 'username_example' # String | name that need to be deleted
body = Petstore::User.new # User | Updated user object
user = Petstore::User.new # User | Updated user object
begin
#Updated user
api_instance.update_user(username, body)
api_instance.update_user(username, user)
rescue Petstore::ApiError => e
puts "Exception when calling UserApi->update_user: #{e}"
end
@ -359,7 +359,7 @@ end
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **String**| name that need to be deleted |
**body** | [**User**](User.md)| Updated user object |
**user** | [**User**](User.md)| Updated user object |
### Return type
@ -371,6 +371,6 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: Not defined

View File

@ -1,73 +0,0 @@
# Petstore::XmlItem
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**attribute_string** | **String** | | [optional]
**attribute_number** | **Float** | | [optional]
**attribute_integer** | **Integer** | | [optional]
**attribute_boolean** | **Boolean** | | [optional]
**wrapped_array** | **Array&lt;Integer&gt;** | | [optional]
**name_string** | **String** | | [optional]
**name_number** | **Float** | | [optional]
**name_integer** | **Integer** | | [optional]
**name_boolean** | **Boolean** | | [optional]
**name_array** | **Array&lt;Integer&gt;** | | [optional]
**name_wrapped_array** | **Array&lt;Integer&gt;** | | [optional]
**prefix_string** | **String** | | [optional]
**prefix_number** | **Float** | | [optional]
**prefix_integer** | **Integer** | | [optional]
**prefix_boolean** | **Boolean** | | [optional]
**prefix_array** | **Array&lt;Integer&gt;** | | [optional]
**prefix_wrapped_array** | **Array&lt;Integer&gt;** | | [optional]
**namespace_string** | **String** | | [optional]
**namespace_number** | **Float** | | [optional]
**namespace_integer** | **Integer** | | [optional]
**namespace_boolean** | **Boolean** | | [optional]
**namespace_array** | **Array&lt;Integer&gt;** | | [optional]
**namespace_wrapped_array** | **Array&lt;Integer&gt;** | | [optional]
**prefix_ns_string** | **String** | | [optional]
**prefix_ns_number** | **Float** | | [optional]
**prefix_ns_integer** | **Integer** | | [optional]
**prefix_ns_boolean** | **Boolean** | | [optional]
**prefix_ns_array** | **Array&lt;Integer&gt;** | | [optional]
**prefix_ns_wrapped_array** | **Array&lt;Integer&gt;** | | [optional]
## Code Sample
```ruby
require 'Petstore'
instance = Petstore::XmlItem.new(attribute_string: string,
attribute_number: 1.234,
attribute_integer: -2,
attribute_boolean: true,
wrapped_array: null,
name_string: string,
name_number: 1.234,
name_integer: -2,
name_boolean: true,
name_array: null,
name_wrapped_array: null,
prefix_string: string,
prefix_number: 1.234,
prefix_integer: -2,
prefix_boolean: true,
prefix_array: null,
prefix_wrapped_array: null,
namespace_string: string,
namespace_number: 1.234,
namespace_integer: -2,
namespace_boolean: true,
namespace_array: null,
namespace_wrapped_array: null,
prefix_ns_string: string,
prefix_ns_number: 1.234,
prefix_ns_integer: -2,
prefix_ns_boolean: true,
prefix_ns_array: null,
prefix_ns_wrapped_array: null)
```

View File

@ -17,21 +17,12 @@ require 'petstore/version'
require 'petstore/configuration'
# Models
require 'petstore/models/additional_properties_any_type'
require 'petstore/models/additional_properties_array'
require 'petstore/models/additional_properties_boolean'
require 'petstore/models/additional_properties_class'
require 'petstore/models/additional_properties_integer'
require 'petstore/models/additional_properties_number'
require 'petstore/models/additional_properties_object'
require 'petstore/models/additional_properties_string'
require 'petstore/models/animal'
require 'petstore/models/api_response'
require 'petstore/models/array_of_array_of_number_only'
require 'petstore/models/array_of_number_only'
require 'petstore/models/array_test'
require 'petstore/models/big_cat'
require 'petstore/models/big_cat_all_of'
require 'petstore/models/capitalization'
require 'petstore/models/cat'
require 'petstore/models/cat_all_of'
@ -45,29 +36,40 @@ require 'petstore/models/enum_class'
require 'petstore/models/enum_test'
require 'petstore/models/file'
require 'petstore/models/file_schema_test_class'
require 'petstore/models/foo'
require 'petstore/models/format_test'
require 'petstore/models/has_only_read_only'
require 'petstore/models/health_check_result'
require 'petstore/models/inline_object'
require 'petstore/models/inline_object1'
require 'petstore/models/inline_object2'
require 'petstore/models/inline_object3'
require 'petstore/models/inline_object4'
require 'petstore/models/inline_object5'
require 'petstore/models/inline_response_default'
require 'petstore/models/list'
require 'petstore/models/map_test'
require 'petstore/models/mixed_properties_and_additional_properties_class'
require 'petstore/models/model200_response'
require 'petstore/models/model_return'
require 'petstore/models/name'
require 'petstore/models/nullable_class'
require 'petstore/models/number_only'
require 'petstore/models/order'
require 'petstore/models/outer_composite'
require 'petstore/models/outer_enum'
require 'petstore/models/outer_enum_default_value'
require 'petstore/models/outer_enum_integer'
require 'petstore/models/outer_enum_integer_default_value'
require 'petstore/models/pet'
require 'petstore/models/read_only_first'
require 'petstore/models/special_model_name'
require 'petstore/models/tag'
require 'petstore/models/type_holder_default'
require 'petstore/models/type_holder_example'
require 'petstore/models/user'
require 'petstore/models/xml_item'
# APIs
require 'petstore/api/another_fake_api'
require 'petstore/api/default_api'
require 'petstore/api/fake_api'
require 'petstore/api/fake_classname_tags123_api'
require 'petstore/api/pet_api'

View File

@ -21,26 +21,26 @@ module Petstore
end
# To test special tags
# To test special tags and operation ID starting with number
# @param body [Client] client model
# @param client [Client] client model
# @param [Hash] opts the optional parameters
# @return [Client]
def call_123_test_special_tags(body, opts = {})
data, _status_code, _headers = call_123_test_special_tags_with_http_info(body, opts)
def call_123_test_special_tags(client, opts = {})
data, _status_code, _headers = call_123_test_special_tags_with_http_info(client, opts)
data
end
# To test special tags
# To test special tags and operation ID starting with number
# @param body [Client] client model
# @param client [Client] client model
# @param [Hash] opts the optional parameters
# @return [Array<(Client, Integer, Hash)>] Client data, response status code and response headers
def call_123_test_special_tags_with_http_info(body, opts = {})
def call_123_test_special_tags_with_http_info(client, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: AnotherFakeApi.call_123_test_special_tags ...'
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling AnotherFakeApi.call_123_test_special_tags"
# verify the required parameter 'client' is set
if @api_client.config.client_side_validation && client.nil?
fail ArgumentError, "Missing the required parameter 'client' when calling AnotherFakeApi.call_123_test_special_tags"
end
# resource path
local_var_path = '/another-fake/dummy'
@ -59,7 +59,7 @@ module Petstore
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body] || @api_client.object_to_http_body(body)
post_body = opts[:body] || @api_client.object_to_http_body(client)
# return_type
return_type = opts[:return_type] || 'Client'

View File

@ -19,48 +19,40 @@ module Petstore
def initialize(api_client = ApiClient.default)
@api_client = api_client
end
# creates an XmlItem
# this route creates an XmlItem
# @param xml_item [XmlItem] XmlItem Body
# Health check endpoint
# @param [Hash] opts the optional parameters
# @return [nil]
def create_xml_item(xml_item, opts = {})
create_xml_item_with_http_info(xml_item, opts)
nil
# @return [HealthCheckResult]
def fake_health_get(opts = {})
data, _status_code, _headers = fake_health_get_with_http_info(opts)
data
end
# creates an XmlItem
# this route creates an XmlItem
# @param xml_item [XmlItem] XmlItem Body
# Health check endpoint
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def create_xml_item_with_http_info(xml_item, opts = {})
# @return [Array<(HealthCheckResult, Integer, Hash)>] HealthCheckResult data, response status code and response headers
def fake_health_get_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: FakeApi.create_xml_item ...'
end
# verify the required parameter 'xml_item' is set
if @api_client.config.client_side_validation && xml_item.nil?
fail ArgumentError, "Missing the required parameter 'xml_item' when calling FakeApi.create_xml_item"
@api_client.config.logger.debug 'Calling API: FakeApi.fake_health_get ...'
end
# resource path
local_var_path = '/fake/create_xml_item'
local_var_path = '/fake/health'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/xml', 'application/xml; charset=utf-8', 'application/xml; charset=utf-16', 'text/xml', 'text/xml; charset=utf-8', 'text/xml; charset=utf-16'])
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body] || @api_client.object_to_http_body(xml_item)
post_body = opts[:body]
# return_type
return_type = opts[:return_type]
return_type = opts[:return_type] || 'HealthCheckResult'
# auth_names
auth_names = opts[:auth_names] || []
@ -74,9 +66,75 @@ module Petstore
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
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#create_xml_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
@api_client.config.logger.debug "API called: FakeApi#fake_health_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# test http signature authentication
# @param pet [Pet] Pet object that needs to be added to the store
# @param [Hash] opts the optional parameters
# @option opts [String] :query_1 query parameter
# @option opts [String] :header_1 header parameter
# @return [nil]
def fake_http_signature_test(pet, opts = {})
fake_http_signature_test_with_http_info(pet, opts)
nil
end
# test http signature authentication
# @param pet [Pet] Pet object that needs to be added to the store
# @param [Hash] opts the optional parameters
# @option opts [String] :query_1 query parameter
# @option opts [String] :header_1 header parameter
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def fake_http_signature_test_with_http_info(pet, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: FakeApi.fake_http_signature_test ...'
end
# verify the required parameter 'pet' is set
if @api_client.config.client_side_validation && pet.nil?
fail ArgumentError, "Missing the required parameter 'pet' when calling FakeApi.fake_http_signature_test"
end
# resource path
local_var_path = '/fake/http-signature-test'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'query_1'] = opts[:'query_1'] if !opts[:'query_1'].nil?
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/xml'])
header_params[:'header_1'] = opts[:'header_1'] if !opts[:'header_1'].nil?
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body] || @api_client.object_to_http_body(pet)
# return_type
return_type = opts[:return_type]
# auth_names
auth_names = opts[:auth_names] || ['http_signature_test']
new_options = opts.merge(
: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#fake_http_signature_test\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
@ -108,6 +166,8 @@ module Petstore
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
@ -139,7 +199,7 @@ module Petstore
# Test serialization of object with outer number type
# @param [Hash] opts the optional parameters
# @option opts [OuterComposite] :body Input composite as post body
# @option opts [OuterComposite] :outer_composite Input composite as post body
# @return [OuterComposite]
def fake_outer_composite_serialize(opts = {})
data, _status_code, _headers = fake_outer_composite_serialize_with_http_info(opts)
@ -148,7 +208,7 @@ module Petstore
# Test serialization of object with outer number type
# @param [Hash] opts the optional parameters
# @option opts [OuterComposite] :body Input composite as post body
# @option opts [OuterComposite] :outer_composite Input composite as post body
# @return [Array<(OuterComposite, Integer, Hash)>] OuterComposite data, response status code and response headers
def fake_outer_composite_serialize_with_http_info(opts = {})
if @api_client.config.debugging
@ -164,12 +224,14 @@ module Petstore
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body] || @api_client.object_to_http_body(opts[:'body'])
post_body = opts[:body] || @api_client.object_to_http_body(opts[:'outer_composite'])
# return_type
return_type = opts[:return_type] || 'OuterComposite'
@ -220,6 +282,8 @@ module Petstore
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
@ -276,6 +340,8 @@ module Petstore
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
@ -306,25 +372,25 @@ module Petstore
end
# For this test, the body for this request much reference a schema named `File`.
# @param body [FileSchemaTestClass]
# @param file_schema_test_class [FileSchemaTestClass]
# @param [Hash] opts the optional parameters
# @return [nil]
def test_body_with_file_schema(body, opts = {})
test_body_with_file_schema_with_http_info(body, opts)
def test_body_with_file_schema(file_schema_test_class, opts = {})
test_body_with_file_schema_with_http_info(file_schema_test_class, opts)
nil
end
# For this test, the body for this request much reference a schema named &#x60;File&#x60;.
# @param body [FileSchemaTestClass]
# @param file_schema_test_class [FileSchemaTestClass]
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def test_body_with_file_schema_with_http_info(body, opts = {})
def test_body_with_file_schema_with_http_info(file_schema_test_class, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: FakeApi.test_body_with_file_schema ...'
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling FakeApi.test_body_with_file_schema"
# verify the required parameter 'file_schema_test_class' is set
if @api_client.config.client_side_validation && file_schema_test_class.nil?
fail ArgumentError, "Missing the required parameter 'file_schema_test_class' when calling FakeApi.test_body_with_file_schema"
end
# resource path
local_var_path = '/fake/body-with-file-schema'
@ -341,7 +407,7 @@ module Petstore
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body] || @api_client.object_to_http_body(body)
post_body = opts[:body] || @api_client.object_to_http_body(file_schema_test_class)
# return_type
return_type = opts[:return_type]
@ -366,19 +432,19 @@ module Petstore
end
# @param query [String]
# @param body [User]
# @param user [User]
# @param [Hash] opts the optional parameters
# @return [nil]
def test_body_with_query_params(query, body, opts = {})
test_body_with_query_params_with_http_info(query, body, opts)
def test_body_with_query_params(query, user, opts = {})
test_body_with_query_params_with_http_info(query, user, opts)
nil
end
# @param query [String]
# @param body [User]
# @param user [User]
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def test_body_with_query_params_with_http_info(query, body, opts = {})
def test_body_with_query_params_with_http_info(query, user, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: FakeApi.test_body_with_query_params ...'
end
@ -386,9 +452,9 @@ module Petstore
if @api_client.config.client_side_validation && query.nil?
fail ArgumentError, "Missing the required parameter 'query' when calling FakeApi.test_body_with_query_params"
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling FakeApi.test_body_with_query_params"
# verify the required parameter 'user' is set
if @api_client.config.client_side_validation && user.nil?
fail ArgumentError, "Missing the required parameter 'user' when calling FakeApi.test_body_with_query_params"
end
# resource path
local_var_path = '/fake/body-with-query-params'
@ -406,7 +472,7 @@ module Petstore
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body] || @api_client.object_to_http_body(body)
post_body = opts[:body] || @api_client.object_to_http_body(user)
# return_type
return_type = opts[:return_type]
@ -432,26 +498,26 @@ module Petstore
# To test \"client\" model
# To test \"client\" model
# @param body [Client] client model
# @param client [Client] client model
# @param [Hash] opts the optional parameters
# @return [Client]
def test_client_model(body, opts = {})
data, _status_code, _headers = test_client_model_with_http_info(body, opts)
def test_client_model(client, opts = {})
data, _status_code, _headers = test_client_model_with_http_info(client, opts)
data
end
# To test \&quot;client\&quot; model
# To test \&quot;client\&quot; model
# @param body [Client] client model
# @param client [Client] client model
# @param [Hash] opts the optional parameters
# @return [Array<(Client, Integer, Hash)>] Client data, response status code and response headers
def test_client_model_with_http_info(body, opts = {})
def test_client_model_with_http_info(client, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: FakeApi.test_client_model ...'
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling FakeApi.test_client_model"
# verify the required parameter 'client' is set
if @api_client.config.client_side_validation && client.nil?
fail ArgumentError, "Missing the required parameter 'client' when calling FakeApi.test_client_model"
end
# resource path
local_var_path = '/fake'
@ -470,7 +536,7 @@ module Petstore
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body] || @api_client.object_to_http_body(body)
post_body = opts[:body] || @api_client.object_to_http_body(client)
# return_type
return_type = opts[:return_type] || 'Client'
@ -732,7 +798,7 @@ module Petstore
# query parameters
query_params = opts[:query_params] || {}
query_params[:'enum_query_string_array'] = @api_client.build_collection_param(opts[:'enum_query_string_array'], :csv) if !opts[:'enum_query_string_array'].nil?
query_params[:'enum_query_string_array'] = @api_client.build_collection_param(opts[:'enum_query_string_array'], :multi) if !opts[:'enum_query_string_array'].nil?
query_params[:'enum_query_string'] = opts[:'enum_query_string'] if !opts[:'enum_query_string'].nil?
query_params[:'enum_query_integer'] = opts[:'enum_query_integer'] if !opts[:'enum_query_integer'].nil?
query_params[:'enum_query_double'] = opts[:'enum_query_double'] if !opts[:'enum_query_double'].nil?
@ -840,7 +906,7 @@ module Petstore
return_type = opts[:return_type]
# auth_names
auth_names = opts[:auth_names] || []
auth_names = opts[:auth_names] || ['bearer_test']
new_options = opts.merge(
:header_params => header_params,
@ -859,25 +925,25 @@ module Petstore
end
# test inline additionalProperties
# @param param [Hash<String, String>] request body
# @param request_body [Hash<String, String>] request body
# @param [Hash] opts the optional parameters
# @return [nil]
def test_inline_additional_properties(param, opts = {})
test_inline_additional_properties_with_http_info(param, opts)
def test_inline_additional_properties(request_body, opts = {})
test_inline_additional_properties_with_http_info(request_body, opts)
nil
end
# test inline additionalProperties
# @param param [Hash<String, String>] request body
# @param request_body [Hash<String, String>] request body
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def test_inline_additional_properties_with_http_info(param, opts = {})
def test_inline_additional_properties_with_http_info(request_body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: FakeApi.test_inline_additional_properties ...'
end
# verify the required parameter 'param' is set
if @api_client.config.client_side_validation && param.nil?
fail ArgumentError, "Missing the required parameter 'param' when calling FakeApi.test_inline_additional_properties"
# verify the required parameter 'request_body' is set
if @api_client.config.client_side_validation && request_body.nil?
fail ArgumentError, "Missing the required parameter 'request_body' when calling FakeApi.test_inline_additional_properties"
end
# resource path
local_var_path = '/fake/inline-additionalProperties'
@ -894,7 +960,7 @@ module Petstore
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body] || @api_client.object_to_http_body(param)
post_body = opts[:body] || @api_client.object_to_http_body(request_body)
# return_type
return_type = opts[:return_type]
@ -1036,7 +1102,7 @@ module Petstore
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pipe'] = @api_client.build_collection_param(pipe, :csv)
query_params[:'pipe'] = @api_client.build_collection_param(pipe, :multi)
query_params[:'ioutil'] = @api_client.build_collection_param(ioutil, :csv)
query_params[:'http'] = @api_client.build_collection_param(http, :space)
query_params[:'url'] = @api_client.build_collection_param(url, :csv)

View File

@ -21,26 +21,26 @@ module Petstore
end
# To test class name in snake case
# To test class name in snake case
# @param body [Client] client model
# @param client [Client] client model
# @param [Hash] opts the optional parameters
# @return [Client]
def test_classname(body, opts = {})
data, _status_code, _headers = test_classname_with_http_info(body, opts)
def test_classname(client, opts = {})
data, _status_code, _headers = test_classname_with_http_info(client, opts)
data
end
# To test class name in snake case
# To test class name in snake case
# @param body [Client] client model
# @param client [Client] client model
# @param [Hash] opts the optional parameters
# @return [Array<(Client, Integer, Hash)>] Client data, response status code and response headers
def test_classname_with_http_info(body, opts = {})
def test_classname_with_http_info(client, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: FakeClassnameTags123Api.test_classname ...'
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling FakeClassnameTags123Api.test_classname"
# verify the required parameter 'client' is set
if @api_client.config.client_side_validation && client.nil?
fail ArgumentError, "Missing the required parameter 'client' when calling FakeClassnameTags123Api.test_classname"
end
# resource path
local_var_path = '/fake_classname_test'
@ -59,7 +59,7 @@ module Petstore
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body] || @api_client.object_to_http_body(body)
post_body = opts[:body] || @api_client.object_to_http_body(client)
# return_type
return_type = opts[:return_type] || 'Client'

View File

@ -20,25 +20,25 @@ module Petstore
@api_client = api_client
end
# Add a new pet to the store
# @param body [Pet] Pet object that needs to be added to the store
# @param pet [Pet] Pet object that needs to be added to the store
# @param [Hash] opts the optional parameters
# @return [nil]
def add_pet(body, opts = {})
add_pet_with_http_info(body, opts)
def add_pet(pet, opts = {})
add_pet_with_http_info(pet, opts)
nil
end
# Add a new pet to the store
# @param body [Pet] Pet object that needs to be added to the store
# @param pet [Pet] Pet object that needs to be added to the store
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def add_pet_with_http_info(body, opts = {})
def add_pet_with_http_info(pet, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PetApi.add_pet ...'
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling PetApi.add_pet"
# verify the required parameter 'pet' is set
if @api_client.config.client_side_validation && pet.nil?
fail ArgumentError, "Missing the required parameter 'pet' when calling PetApi.add_pet"
end
# resource path
local_var_path = '/pet'
@ -55,7 +55,7 @@ module Petstore
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body] || @api_client.object_to_http_body(body)
post_body = opts[:body] || @api_client.object_to_http_body(pet)
# return_type
return_type = opts[:return_type]
@ -103,7 +103,7 @@ module Petstore
fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.delete_pet"
end
# resource path
local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/'))
local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
@ -290,7 +290,7 @@ module Petstore
fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.get_pet_by_id"
end
# resource path
local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/'))
local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
@ -329,25 +329,25 @@ module Petstore
end
# Update an existing pet
# @param body [Pet] Pet object that needs to be added to the store
# @param pet [Pet] Pet object that needs to be added to the store
# @param [Hash] opts the optional parameters
# @return [nil]
def update_pet(body, opts = {})
update_pet_with_http_info(body, opts)
def update_pet(pet, opts = {})
update_pet_with_http_info(pet, opts)
nil
end
# Update an existing pet
# @param body [Pet] Pet object that needs to be added to the store
# @param pet [Pet] Pet object that needs to be added to the store
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def update_pet_with_http_info(body, opts = {})
def update_pet_with_http_info(pet, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PetApi.update_pet ...'
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling PetApi.update_pet"
# verify the required parameter 'pet' is set
if @api_client.config.client_side_validation && pet.nil?
fail ArgumentError, "Missing the required parameter 'pet' when calling PetApi.update_pet"
end
# resource path
local_var_path = '/pet'
@ -364,7 +364,7 @@ module Petstore
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body] || @api_client.object_to_http_body(body)
post_body = opts[:body] || @api_client.object_to_http_body(pet)
# return_type
return_type = opts[:return_type]
@ -414,7 +414,7 @@ module Petstore
fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.update_pet_with_form"
end
# resource path
local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/'))
local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
@ -480,7 +480,7 @@ module Petstore
fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.upload_file"
end
# resource path
local_var_path = '/pet/{petId}/uploadImage'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/'))
local_var_path = '/pet/{petId}/uploadImage'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
@ -552,7 +552,7 @@ module Petstore
fail ArgumentError, "Missing the required parameter 'required_file' when calling PetApi.upload_file_with_required_file"
end
# resource path
local_var_path = '/fake/{petId}/uploadImageWithRequiredFile'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/'))
local_var_path = '/fake/{petId}/uploadImageWithRequiredFile'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s))
# query parameters
query_params = opts[:query_params] || {}

View File

@ -43,7 +43,7 @@ module Petstore
fail ArgumentError, "Missing the required parameter 'order_id' when calling StoreApi.delete_order"
end
# resource path
local_var_path = '/store/order/{order_id}'.sub('{' + 'order_id' + '}', CGI.escape(order_id.to_s).gsub('%2F', '/'))
local_var_path = '/store/order/{order_id}'.sub('{' + 'order_id' + '}', CGI.escape(order_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
@ -167,7 +167,7 @@ module Petstore
end
# resource path
local_var_path = '/store/order/{order_id}'.sub('{' + 'order_id' + '}', CGI.escape(order_id.to_s).gsub('%2F', '/'))
local_var_path = '/store/order/{order_id}'.sub('{' + 'order_id' + '}', CGI.escape(order_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
@ -206,25 +206,25 @@ module Petstore
end
# Place an order for a pet
# @param body [Order] order placed for purchasing the pet
# @param order [Order] order placed for purchasing the pet
# @param [Hash] opts the optional parameters
# @return [Order]
def place_order(body, opts = {})
data, _status_code, _headers = place_order_with_http_info(body, opts)
def place_order(order, opts = {})
data, _status_code, _headers = place_order_with_http_info(order, opts)
data
end
# Place an order for a pet
# @param body [Order] order placed for purchasing the pet
# @param order [Order] order placed for purchasing the pet
# @param [Hash] opts the optional parameters
# @return [Array<(Order, Integer, Hash)>] Order data, response status code and response headers
def place_order_with_http_info(body, opts = {})
def place_order_with_http_info(order, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: StoreApi.place_order ...'
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling StoreApi.place_order"
# verify the required parameter 'order' is set
if @api_client.config.client_side_validation && order.nil?
fail ArgumentError, "Missing the required parameter 'order' when calling StoreApi.place_order"
end
# resource path
local_var_path = '/store/order'
@ -236,12 +236,14 @@ module Petstore
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body] || @api_client.object_to_http_body(body)
post_body = opts[:body] || @api_client.object_to_http_body(order)
# return_type
return_type = opts[:return_type] || 'Order'

View File

@ -21,26 +21,26 @@ module Petstore
end
# Create user
# This can only be done by the logged in user.
# @param body [User] Created user object
# @param user [User] Created user object
# @param [Hash] opts the optional parameters
# @return [nil]
def create_user(body, opts = {})
create_user_with_http_info(body, opts)
def create_user(user, opts = {})
create_user_with_http_info(user, opts)
nil
end
# Create user
# This can only be done by the logged in user.
# @param body [User] Created user object
# @param user [User] Created user object
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def create_user_with_http_info(body, opts = {})
def create_user_with_http_info(user, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: UserApi.create_user ...'
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling UserApi.create_user"
# verify the required parameter 'user' is set
if @api_client.config.client_side_validation && user.nil?
fail ArgumentError, "Missing the required parameter 'user' when calling UserApi.create_user"
end
# resource path
local_var_path = '/user'
@ -50,12 +50,14 @@ module Petstore
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body] || @api_client.object_to_http_body(body)
post_body = opts[:body] || @api_client.object_to_http_body(user)
# return_type
return_type = opts[:return_type]
@ -80,25 +82,25 @@ module Petstore
end
# Creates list of users with given input array
# @param body [Array<User>] List of user object
# @param user [Array<User>] List of user object
# @param [Hash] opts the optional parameters
# @return [nil]
def create_users_with_array_input(body, opts = {})
create_users_with_array_input_with_http_info(body, opts)
def create_users_with_array_input(user, opts = {})
create_users_with_array_input_with_http_info(user, opts)
nil
end
# Creates list of users with given input array
# @param body [Array<User>] List of user object
# @param user [Array<User>] List of user object
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def create_users_with_array_input_with_http_info(body, opts = {})
def create_users_with_array_input_with_http_info(user, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: UserApi.create_users_with_array_input ...'
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling UserApi.create_users_with_array_input"
# verify the required parameter 'user' is set
if @api_client.config.client_side_validation && user.nil?
fail ArgumentError, "Missing the required parameter 'user' when calling UserApi.create_users_with_array_input"
end
# resource path
local_var_path = '/user/createWithArray'
@ -108,12 +110,14 @@ module Petstore
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body] || @api_client.object_to_http_body(body)
post_body = opts[:body] || @api_client.object_to_http_body(user)
# return_type
return_type = opts[:return_type]
@ -138,25 +142,25 @@ module Petstore
end
# Creates list of users with given input array
# @param body [Array<User>] List of user object
# @param user [Array<User>] List of user object
# @param [Hash] opts the optional parameters
# @return [nil]
def create_users_with_list_input(body, opts = {})
create_users_with_list_input_with_http_info(body, opts)
def create_users_with_list_input(user, opts = {})
create_users_with_list_input_with_http_info(user, opts)
nil
end
# Creates list of users with given input array
# @param body [Array<User>] List of user object
# @param user [Array<User>] List of user object
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def create_users_with_list_input_with_http_info(body, opts = {})
def create_users_with_list_input_with_http_info(user, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: UserApi.create_users_with_list_input ...'
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling UserApi.create_users_with_list_input"
# verify the required parameter 'user' is set
if @api_client.config.client_side_validation && user.nil?
fail ArgumentError, "Missing the required parameter 'user' when calling UserApi.create_users_with_list_input"
end
# resource path
local_var_path = '/user/createWithList'
@ -166,12 +170,14 @@ module Petstore
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body] || @api_client.object_to_http_body(body)
post_body = opts[:body] || @api_client.object_to_http_body(user)
# return_type
return_type = opts[:return_type]
@ -219,7 +225,7 @@ module Petstore
fail ArgumentError, "Missing the required parameter 'username' when calling UserApi.delete_user"
end
# resource path
local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s).gsub('%2F', '/'))
local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s))
# query parameters
query_params = opts[:query_params] || {}
@ -277,7 +283,7 @@ module Petstore
fail ArgumentError, "Missing the required parameter 'username' when calling UserApi.get_user_by_name"
end
# resource path
local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s).gsub('%2F', '/'))
local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s))
# query parameters
query_params = opts[:query_params] || {}
@ -438,21 +444,21 @@ module Petstore
# Updated user
# This can only be done by the logged in user.
# @param username [String] name that need to be deleted
# @param body [User] Updated user object
# @param user [User] Updated user object
# @param [Hash] opts the optional parameters
# @return [nil]
def update_user(username, body, opts = {})
update_user_with_http_info(username, body, opts)
def update_user(username, user, opts = {})
update_user_with_http_info(username, user, opts)
nil
end
# Updated user
# This can only be done by the logged in user.
# @param username [String] name that need to be deleted
# @param body [User] Updated user object
# @param user [User] Updated user object
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def update_user_with_http_info(username, body, opts = {})
def update_user_with_http_info(username, user, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: UserApi.update_user ...'
end
@ -460,24 +466,26 @@ module Petstore
if @api_client.config.client_side_validation && username.nil?
fail ArgumentError, "Missing the required parameter 'username' when calling UserApi.update_user"
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling UserApi.update_user"
# verify the required parameter 'user' is set
if @api_client.config.client_side_validation && user.nil?
fail ArgumentError, "Missing the required parameter 'user' when calling UserApi.update_user"
end
# resource path
local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s).gsub('%2F', '/'))
local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body] || @api_client.object_to_http_body(body)
post_body = opts[:body] || @api_client.object_to_http_body(user)
# return_type
return_type = opts[:return_type]

View File

@ -202,6 +202,14 @@ module Petstore
key: 'api_key_query',
value: api_key_with_prefix('api_key_query')
},
'bearer_test' =>
{
type: 'bearer',
in: 'header',
format: 'JWT',
key: 'Authorization',
value: "Bearer #{access_token}"
},
'http_basic_test' =>
{
type: 'basic',
@ -223,8 +231,41 @@ module Petstore
def server_settings
[
{
url: "http://petstore.swagger.io:80/v2",
url: "http://{server}.swagger.io:{port}/v2",
description: "petstore server",
variables: {
server: {
description: "No description provided",
default_value: "petstore",
enum_values: [
"petstore",
"qa-petstore",
"dev-petstore"
]
},
port: {
description: "No description provided",
default_value: "80",
enum_values: [
"80",
"8080"
]
}
}
},
{
url: "https://localhost:8080/{version}",
description: "The local server",
variables: {
version: {
description: "No description provided",
default_value: "v2",
enum_values: [
"v1",
"v2"
]
}
}
}
]
end

View File

@ -1,206 +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: 5.0.0-SNAPSHOT
=end
require 'date'
module Petstore
class AdditionalPropertiesAnyType
attr_accessor :name
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'name' => :'name'
}
end
# Attribute type mapping.
def self.openapi_types
{
:'name' => :'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::AdditionalPropertiesAnyType` 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::AdditionalPropertiesAnyType`. 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
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
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].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 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 # or else data not found in attributes(hash), not an issue as the data can be optional
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 :DateTime
DateTime.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
Petstore.const_get(type).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

View File

@ -1,206 +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: 5.0.0-SNAPSHOT
=end
require 'date'
module Petstore
class AdditionalPropertiesArray
attr_accessor :name
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'name' => :'name'
}
end
# Attribute type mapping.
def self.openapi_types
{
:'name' => :'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::AdditionalPropertiesArray` 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::AdditionalPropertiesArray`. 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
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
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].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 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 # or else data not found in attributes(hash), not an issue as the data can be optional
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 :DateTime
DateTime.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
Petstore.const_get(type).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

View File

@ -1,206 +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: 5.0.0-SNAPSHOT
=end
require 'date'
module Petstore
class AdditionalPropertiesBoolean
attr_accessor :name
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'name' => :'name'
}
end
# Attribute type mapping.
def self.openapi_types
{
:'name' => :'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::AdditionalPropertiesBoolean` 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::AdditionalPropertiesBoolean`. 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
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
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].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 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 # or else data not found in attributes(hash), not an issue as the data can be optional
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 :DateTime
DateTime.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
Petstore.const_get(type).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

View File

@ -14,59 +14,23 @@ require 'date'
module Petstore
class AdditionalPropertiesClass
attr_accessor :map_string
attr_accessor :map_property
attr_accessor :map_number
attr_accessor :map_integer
attr_accessor :map_boolean
attr_accessor :map_array_integer
attr_accessor :map_array_anytype
attr_accessor :map_map_string
attr_accessor :map_map_anytype
attr_accessor :anytype_1
attr_accessor :anytype_2
attr_accessor :anytype_3
attr_accessor :map_of_map_property
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'map_string' => :'map_string',
:'map_number' => :'map_number',
:'map_integer' => :'map_integer',
:'map_boolean' => :'map_boolean',
:'map_array_integer' => :'map_array_integer',
:'map_array_anytype' => :'map_array_anytype',
:'map_map_string' => :'map_map_string',
:'map_map_anytype' => :'map_map_anytype',
:'anytype_1' => :'anytype_1',
:'anytype_2' => :'anytype_2',
:'anytype_3' => :'anytype_3'
:'map_property' => :'map_property',
:'map_of_map_property' => :'map_of_map_property'
}
end
# Attribute type mapping.
def self.openapi_types
{
:'map_string' => :'Hash<String, String>',
:'map_number' => :'Hash<String, Float>',
:'map_integer' => :'Hash<String, Integer>',
:'map_boolean' => :'Hash<String, Boolean>',
:'map_array_integer' => :'Hash<String, Array<Integer>>',
:'map_array_anytype' => :'Hash<String, Array<Object>>',
:'map_map_string' => :'Hash<String, Hash<String, String>>',
:'map_map_anytype' => :'Hash<String, Hash<String, Object>>',
:'anytype_1' => :'Object',
:'anytype_2' => :'Object',
:'anytype_3' => :'Object'
:'map_property' => :'Hash<String, String>',
:'map_of_map_property' => :'Hash<String, Hash<String, String>>'
}
end
@ -91,65 +55,17 @@ module Petstore
h[k.to_sym] = v
}
if attributes.key?(:'map_string')
if (value = attributes[:'map_string']).is_a?(Hash)
self.map_string = value
if attributes.key?(:'map_property')
if (value = attributes[:'map_property']).is_a?(Hash)
self.map_property = value
end
end
if attributes.key?(:'map_number')
if (value = attributes[:'map_number']).is_a?(Hash)
self.map_number = value
if attributes.key?(:'map_of_map_property')
if (value = attributes[:'map_of_map_property']).is_a?(Hash)
self.map_of_map_property = value
end
end
if attributes.key?(:'map_integer')
if (value = attributes[:'map_integer']).is_a?(Hash)
self.map_integer = value
end
end
if attributes.key?(:'map_boolean')
if (value = attributes[:'map_boolean']).is_a?(Hash)
self.map_boolean = value
end
end
if attributes.key?(:'map_array_integer')
if (value = attributes[:'map_array_integer']).is_a?(Hash)
self.map_array_integer = value
end
end
if attributes.key?(:'map_array_anytype')
if (value = attributes[:'map_array_anytype']).is_a?(Hash)
self.map_array_anytype = value
end
end
if attributes.key?(:'map_map_string')
if (value = attributes[:'map_map_string']).is_a?(Hash)
self.map_map_string = value
end
end
if attributes.key?(:'map_map_anytype')
if (value = attributes[:'map_map_anytype']).is_a?(Hash)
self.map_map_anytype = value
end
end
if attributes.key?(:'anytype_1')
self.anytype_1 = attributes[:'anytype_1']
end
if attributes.key?(:'anytype_2')
self.anytype_2 = attributes[:'anytype_2']
end
if attributes.key?(:'anytype_3')
self.anytype_3 = attributes[:'anytype_3']
end
end
# Show invalid properties with the reasons. Usually used together with valid?
@ -170,17 +86,8 @@ module Petstore
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
map_string == o.map_string &&
map_number == o.map_number &&
map_integer == o.map_integer &&
map_boolean == o.map_boolean &&
map_array_integer == o.map_array_integer &&
map_array_anytype == o.map_array_anytype &&
map_map_string == o.map_map_string &&
map_map_anytype == o.map_map_anytype &&
anytype_1 == o.anytype_1 &&
anytype_2 == o.anytype_2 &&
anytype_3 == o.anytype_3
map_property == o.map_property &&
map_of_map_property == o.map_of_map_property
end
# @see the `==` method
@ -192,7 +99,7 @@ module Petstore
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
[map_string, map_number, map_integer, map_boolean, map_array_integer, map_array_anytype, map_map_string, map_map_anytype, anytype_1, anytype_2, anytype_3].hash
[map_property, map_of_map_property].hash
end
# Builds the object from hash

View File

@ -1,206 +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: 5.0.0-SNAPSHOT
=end
require 'date'
module Petstore
class AdditionalPropertiesInteger
attr_accessor :name
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'name' => :'name'
}
end
# Attribute type mapping.
def self.openapi_types
{
:'name' => :'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::AdditionalPropertiesInteger` 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::AdditionalPropertiesInteger`. 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
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
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].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 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 # or else data not found in attributes(hash), not an issue as the data can be optional
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 :DateTime
DateTime.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
Petstore.const_get(type).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

View File

@ -1,206 +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: 5.0.0-SNAPSHOT
=end
require 'date'
module Petstore
class AdditionalPropertiesNumber
attr_accessor :name
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'name' => :'name'
}
end
# Attribute type mapping.
def self.openapi_types
{
:'name' => :'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::AdditionalPropertiesNumber` 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::AdditionalPropertiesNumber`. 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
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
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].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 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 # or else data not found in attributes(hash), not an issue as the data can be optional
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 :DateTime
DateTime.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
Petstore.const_get(type).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

View File

@ -1,206 +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: 5.0.0-SNAPSHOT
=end
require 'date'
module Petstore
class AdditionalPropertiesObject
attr_accessor :name
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'name' => :'name'
}
end
# Attribute type mapping.
def self.openapi_types
{
:'name' => :'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::AdditionalPropertiesObject` 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::AdditionalPropertiesObject`. 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
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
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].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 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 # or else data not found in attributes(hash), not an issue as the data can be optional
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 :DateTime
DateTime.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
Petstore.const_get(type).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

View File

@ -1,206 +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: 5.0.0-SNAPSHOT
=end
require 'date'
module Petstore
class AdditionalPropertiesString
attr_accessor :name
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'name' => :'name'
}
end
# Attribute type mapping.
def self.openapi_types
{
:'name' => :'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::AdditionalPropertiesString` 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::AdditionalPropertiesString`. 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
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
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].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 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 # or else data not found in attributes(hash), not an issue as the data can be optional
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 :DateTime
DateTime.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
Petstore.const_get(type).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

View File

@ -1,252 +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: 5.0.0-SNAPSHOT
=end
require 'date'
module Petstore
class BigCat < Cat
attr_accessor :kind
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
{
:'kind' => :'kind'
}
end
# Attribute type mapping.
def self.openapi_types
{
:'kind' => :'String'
}
end
# List of attributes with nullable: true
def self.openapi_nullable
Set.new([
])
end
# List of class defined in allOf (OpenAPI v3)
def self.openapi_all_of
[
:'BigCatAllOf',
:'Cat'
]
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::BigCat` 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::BigCat`. 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?(:'kind')
self.kind = attributes[:'kind']
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 = super
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?
kind_validator = EnumAttributeValidator.new('String', ["lions", "tigers", "leopards", "jaguars"])
return false unless kind_validator.valid?(@kind)
true && super
end
# Custom attribute writer method checking allowed values (enum).
# @param [Object] kind Object to be assigned
def kind=(kind)
validator = EnumAttributeValidator.new('String', ["lions", "tigers", "leopards", "jaguars"])
unless validator.valid?(kind)
fail ArgumentError, "invalid value for \"kind\", must be one of #{validator.allowable_values}."
end
@kind = kind
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 &&
kind == o.kind && super(o)
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
[kind].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)
super(attributes)
self.class.openapi_types.each_pair do |key, type|
if 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 # or else data not found in attributes(hash), not an issue as the data can be optional
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 :DateTime
DateTime.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
Petstore.const_get(type).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 = super
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

View File

@ -1,240 +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: 5.0.0-SNAPSHOT
=end
require 'date'
module Petstore
class BigCatAllOf
attr_accessor :kind
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
{
:'kind' => :'kind'
}
end
# Attribute type mapping.
def self.openapi_types
{
:'kind' => :'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::BigCatAllOf` 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::BigCatAllOf`. 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?(:'kind')
self.kind = attributes[:'kind']
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?
kind_validator = EnumAttributeValidator.new('String', ["lions", "tigers", "leopards", "jaguars"])
return false unless kind_validator.valid?(@kind)
true
end
# Custom attribute writer method checking allowed values (enum).
# @param [Object] kind Object to be assigned
def kind=(kind)
validator = EnumAttributeValidator.new('String', ["lions", "tigers", "leopards", "jaguars"])
unless validator.valid?(kind)
fail ArgumentError, "invalid value for \"kind\", must be one of #{validator.allowable_values}."
end
@kind = kind
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 &&
kind == o.kind
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
[kind].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 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 # or else data not found in attributes(hash), not an issue as the data can be optional
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 :DateTime
DateTime.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
Petstore.const_get(type).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

View File

@ -24,6 +24,12 @@ module Petstore
attr_accessor :outer_enum
attr_accessor :outer_enum_integer
attr_accessor :outer_enum_default_value
attr_accessor :outer_enum_integer_default_value
class EnumAttributeValidator
attr_reader :datatype
attr_reader :allowable_values
@ -53,7 +59,10 @@ module Petstore
:'enum_string_required' => :'enum_string_required',
:'enum_integer' => :'enum_integer',
:'enum_number' => :'enum_number',
:'outer_enum' => :'outerEnum'
:'outer_enum' => :'outerEnum',
:'outer_enum_integer' => :'outerEnumInteger',
:'outer_enum_default_value' => :'outerEnumDefaultValue',
:'outer_enum_integer_default_value' => :'outerEnumIntegerDefaultValue'
}
end
@ -64,13 +73,17 @@ module Petstore
:'enum_string_required' => :'String',
:'enum_integer' => :'Integer',
:'enum_number' => :'Float',
:'outer_enum' => :'OuterEnum'
:'outer_enum' => :'OuterEnum',
:'outer_enum_integer' => :'OuterEnumInteger',
:'outer_enum_default_value' => :'OuterEnumDefaultValue',
:'outer_enum_integer_default_value' => :'OuterEnumIntegerDefaultValue'
}
end
# List of attributes with nullable: true
def self.openapi_nullable
Set.new([
:'outer_enum',
])
end
@ -108,6 +121,18 @@ module Petstore
if attributes.key?(:'outer_enum')
self.outer_enum = attributes[:'outer_enum']
end
if attributes.key?(:'outer_enum_integer')
self.outer_enum_integer = attributes[:'outer_enum_integer']
end
if attributes.key?(:'outer_enum_default_value')
self.outer_enum_default_value = attributes[:'outer_enum_default_value']
end
if attributes.key?(:'outer_enum_integer_default_value')
self.outer_enum_integer_default_value = attributes[:'outer_enum_integer_default_value']
end
end
# Show invalid properties with the reasons. Usually used together with valid?
@ -185,7 +210,10 @@ module Petstore
enum_string_required == o.enum_string_required &&
enum_integer == o.enum_integer &&
enum_number == o.enum_number &&
outer_enum == o.outer_enum
outer_enum == o.outer_enum &&
outer_enum_integer == o.outer_enum_integer &&
outer_enum_default_value == o.outer_enum_default_value &&
outer_enum_integer_default_value == o.outer_enum_integer_default_value
end
# @see the `==` method
@ -197,7 +225,7 @@ module Petstore
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
[enum_string, enum_string_required, enum_integer, enum_number, outer_enum].hash
[enum_string, enum_string_required, enum_integer, enum_number, outer_enum, outer_enum_integer, outer_enum_default_value, outer_enum_integer_default_value].hash
end
# Builds the object from hash

View File

@ -40,7 +40,11 @@ module Petstore
attr_accessor :password
attr_accessor :big_decimal
# A string that is a 10 digit number. Can have leading zeros.
attr_accessor :pattern_with_digits
# A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.
attr_accessor :pattern_with_digits_and_delimiter
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
@ -58,7 +62,8 @@ module Petstore
:'date_time' => :'dateTime',
:'uuid' => :'uuid',
:'password' => :'password',
:'big_decimal' => :'BigDecimal'
:'pattern_with_digits' => :'pattern_with_digits',
:'pattern_with_digits_and_delimiter' => :'pattern_with_digits_and_delimiter'
}
end
@ -78,7 +83,8 @@ module Petstore
:'date_time' => :'DateTime',
:'uuid' => :'String',
:'password' => :'String',
:'big_decimal' => :'BigDecimal'
:'pattern_with_digits' => :'String',
:'pattern_with_digits_and_delimiter' => :'String'
}
end
@ -155,8 +161,12 @@ module Petstore
self.password = attributes[:'password']
end
if attributes.key?(:'big_decimal')
self.big_decimal = attributes[:'big_decimal']
if attributes.key?(:'pattern_with_digits')
self.pattern_with_digits = attributes[:'pattern_with_digits']
end
if attributes.key?(:'pattern_with_digits_and_delimiter')
self.pattern_with_digits_and_delimiter = attributes[:'pattern_with_digits_and_delimiter']
end
end
@ -217,11 +227,6 @@ module Petstore
invalid_properties.push('invalid value for "byte", byte cannot be nil.')
end
pattern = Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
if @byte !~ pattern
invalid_properties.push("invalid value for \"byte\", must conform to the pattern #{pattern}.")
end
if @date.nil?
invalid_properties.push('invalid value for "date", date cannot be nil.')
end
@ -238,6 +243,16 @@ module Petstore
invalid_properties.push('invalid value for "password", the character length must be great than or equal to 10.')
end
pattern = Regexp.new(/^\d{10}$/)
if !@pattern_with_digits.nil? && @pattern_with_digits !~ pattern
invalid_properties.push("invalid value for \"pattern_with_digits\", must conform to the pattern #{pattern}.")
end
pattern = Regexp.new(/^image_\d{1,3}$/i)
if !@pattern_with_digits_and_delimiter.nil? && @pattern_with_digits_and_delimiter !~ pattern
invalid_properties.push("invalid value for \"pattern_with_digits_and_delimiter\", must conform to the pattern #{pattern}.")
end
invalid_properties
end
@ -257,11 +272,12 @@ module Petstore
return false if !@double.nil? && @double < 67.8
return false if !@string.nil? && @string !~ Regexp.new(/[a-z]/i)
return false if @byte.nil?
return false if @byte !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
return false if @date.nil?
return false if @password.nil?
return false if @password.to_s.length > 64
return false if @password.to_s.length < 10
return false if !@pattern_with_digits.nil? && @pattern_with_digits !~ Regexp.new(/^\d{10}$/)
return false if !@pattern_with_digits_and_delimiter.nil? && @pattern_with_digits_and_delimiter !~ Regexp.new(/^image_\d{1,3}$/i)
true
end
@ -350,21 +366,6 @@ module Petstore
@string = string
end
# Custom attribute writer method with validation
# @param [Object] byte Value to be assigned
def byte=(byte)
if byte.nil?
fail ArgumentError, 'byte cannot be nil'
end
pattern = Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
if byte !~ pattern
fail ArgumentError, "invalid value for \"byte\", must conform to the pattern #{pattern}."
end
@byte = byte
end
# Custom attribute writer method with validation
# @param [Object] password Value to be assigned
def password=(password)
@ -383,6 +384,28 @@ module Petstore
@password = password
end
# Custom attribute writer method with validation
# @param [Object] pattern_with_digits Value to be assigned
def pattern_with_digits=(pattern_with_digits)
pattern = Regexp.new(/^\d{10}$/)
if !pattern_with_digits.nil? && pattern_with_digits !~ pattern
fail ArgumentError, "invalid value for \"pattern_with_digits\", must conform to the pattern #{pattern}."
end
@pattern_with_digits = pattern_with_digits
end
# Custom attribute writer method with validation
# @param [Object] pattern_with_digits_and_delimiter Value to be assigned
def pattern_with_digits_and_delimiter=(pattern_with_digits_and_delimiter)
pattern = Regexp.new(/^image_\d{1,3}$/i)
if !pattern_with_digits_and_delimiter.nil? && pattern_with_digits_and_delimiter !~ pattern
fail ArgumentError, "invalid value for \"pattern_with_digits_and_delimiter\", must conform to the pattern #{pattern}."
end
@pattern_with_digits_and_delimiter = pattern_with_digits_and_delimiter
end
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
def ==(o)
@ -401,7 +424,8 @@ module Petstore
date_time == o.date_time &&
uuid == o.uuid &&
password == o.password &&
big_decimal == o.big_decimal
pattern_with_digits == o.pattern_with_digits &&
pattern_with_digits_and_delimiter == o.pattern_with_digits_and_delimiter
end
# @see the `==` method
@ -413,7 +437,7 @@ module Petstore
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
[integer, int32, int64, number, float, double, string, byte, binary, date, date_time, uuid, password, big_decimal].hash
[integer, int32, int64, number, float, double, string, byte, binary, date, date_time, uuid, password, pattern_with_digits, pattern_with_digits_and_delimiter].hash
end
# Builds the object from hash

View File

@ -1,273 +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: 5.0.0-SNAPSHOT
=end
require 'date'
module Petstore
class TypeHolderDefault
attr_accessor :string_item
attr_accessor :number_item
attr_accessor :integer_item
attr_accessor :bool_item
attr_accessor :array_item
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'string_item' => :'string_item',
:'number_item' => :'number_item',
:'integer_item' => :'integer_item',
:'bool_item' => :'bool_item',
:'array_item' => :'array_item'
}
end
# Attribute type mapping.
def self.openapi_types
{
:'string_item' => :'String',
:'number_item' => :'Float',
:'integer_item' => :'Integer',
:'bool_item' => :'Boolean',
:'array_item' => :'Array<Integer>'
}
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::TypeHolderDefault` 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::TypeHolderDefault`. 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_item')
self.string_item = attributes[:'string_item']
else
self.string_item = 'what'
end
if attributes.key?(:'number_item')
self.number_item = attributes[:'number_item']
end
if attributes.key?(:'integer_item')
self.integer_item = attributes[:'integer_item']
end
if attributes.key?(:'bool_item')
self.bool_item = attributes[:'bool_item']
else
self.bool_item = true
end
if attributes.key?(:'array_item')
if (value = attributes[:'array_item']).is_a?(Array)
self.array_item = value
end
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 @string_item.nil?
invalid_properties.push('invalid value for "string_item", string_item cannot be nil.')
end
if @number_item.nil?
invalid_properties.push('invalid value for "number_item", number_item cannot be nil.')
end
if @integer_item.nil?
invalid_properties.push('invalid value for "integer_item", integer_item cannot be nil.')
end
if @bool_item.nil?
invalid_properties.push('invalid value for "bool_item", bool_item cannot be nil.')
end
if @array_item.nil?
invalid_properties.push('invalid value for "array_item", array_item 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 @string_item.nil?
return false if @number_item.nil?
return false if @integer_item.nil?
return false if @bool_item.nil?
return false if @array_item.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 &&
string_item == o.string_item &&
number_item == o.number_item &&
integer_item == o.integer_item &&
bool_item == o.bool_item &&
array_item == o.array_item
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_item, number_item, integer_item, bool_item, array_item].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 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 # or else data not found in attributes(hash), not an issue as the data can be optional
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 :DateTime
DateTime.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
Petstore.const_get(type).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

View File

@ -1,283 +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: 5.0.0-SNAPSHOT
=end
require 'date'
module Petstore
class TypeHolderExample
attr_accessor :string_item
attr_accessor :number_item
attr_accessor :float_item
attr_accessor :integer_item
attr_accessor :bool_item
attr_accessor :array_item
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'string_item' => :'string_item',
:'number_item' => :'number_item',
:'float_item' => :'float_item',
:'integer_item' => :'integer_item',
:'bool_item' => :'bool_item',
:'array_item' => :'array_item'
}
end
# Attribute type mapping.
def self.openapi_types
{
:'string_item' => :'String',
:'number_item' => :'Float',
:'float_item' => :'Float',
:'integer_item' => :'Integer',
:'bool_item' => :'Boolean',
:'array_item' => :'Array<Integer>'
}
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::TypeHolderExample` 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::TypeHolderExample`. 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_item')
self.string_item = attributes[:'string_item']
end
if attributes.key?(:'number_item')
self.number_item = attributes[:'number_item']
end
if attributes.key?(:'float_item')
self.float_item = attributes[:'float_item']
end
if attributes.key?(:'integer_item')
self.integer_item = attributes[:'integer_item']
end
if attributes.key?(:'bool_item')
self.bool_item = attributes[:'bool_item']
end
if attributes.key?(:'array_item')
if (value = attributes[:'array_item']).is_a?(Array)
self.array_item = value
end
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 @string_item.nil?
invalid_properties.push('invalid value for "string_item", string_item cannot be nil.')
end
if @number_item.nil?
invalid_properties.push('invalid value for "number_item", number_item cannot be nil.')
end
if @float_item.nil?
invalid_properties.push('invalid value for "float_item", float_item cannot be nil.')
end
if @integer_item.nil?
invalid_properties.push('invalid value for "integer_item", integer_item cannot be nil.')
end
if @bool_item.nil?
invalid_properties.push('invalid value for "bool_item", bool_item cannot be nil.')
end
if @array_item.nil?
invalid_properties.push('invalid value for "array_item", array_item 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 @string_item.nil?
return false if @number_item.nil?
return false if @float_item.nil?
return false if @integer_item.nil?
return false if @bool_item.nil?
return false if @array_item.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 &&
string_item == o.string_item &&
number_item == o.number_item &&
float_item == o.float_item &&
integer_item == o.integer_item &&
bool_item == o.bool_item &&
array_item == o.array_item
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_item, number_item, float_item, integer_item, bool_item, array_item].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 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 # or else data not found in attributes(hash), not an issue as the data can be optional
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 :DateTime
DateTime.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
Petstore.const_get(type).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

View File

@ -1,476 +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: 5.0.0-SNAPSHOT
=end
require 'date'
module Petstore
class XmlItem
attr_accessor :attribute_string
attr_accessor :attribute_number
attr_accessor :attribute_integer
attr_accessor :attribute_boolean
attr_accessor :wrapped_array
attr_accessor :name_string
attr_accessor :name_number
attr_accessor :name_integer
attr_accessor :name_boolean
attr_accessor :name_array
attr_accessor :name_wrapped_array
attr_accessor :prefix_string
attr_accessor :prefix_number
attr_accessor :prefix_integer
attr_accessor :prefix_boolean
attr_accessor :prefix_array
attr_accessor :prefix_wrapped_array
attr_accessor :namespace_string
attr_accessor :namespace_number
attr_accessor :namespace_integer
attr_accessor :namespace_boolean
attr_accessor :namespace_array
attr_accessor :namespace_wrapped_array
attr_accessor :prefix_ns_string
attr_accessor :prefix_ns_number
attr_accessor :prefix_ns_integer
attr_accessor :prefix_ns_boolean
attr_accessor :prefix_ns_array
attr_accessor :prefix_ns_wrapped_array
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'attribute_string' => :'attribute_string',
:'attribute_number' => :'attribute_number',
:'attribute_integer' => :'attribute_integer',
:'attribute_boolean' => :'attribute_boolean',
:'wrapped_array' => :'wrapped_array',
:'name_string' => :'name_string',
:'name_number' => :'name_number',
:'name_integer' => :'name_integer',
:'name_boolean' => :'name_boolean',
:'name_array' => :'name_array',
:'name_wrapped_array' => :'name_wrapped_array',
:'prefix_string' => :'prefix_string',
:'prefix_number' => :'prefix_number',
:'prefix_integer' => :'prefix_integer',
:'prefix_boolean' => :'prefix_boolean',
:'prefix_array' => :'prefix_array',
:'prefix_wrapped_array' => :'prefix_wrapped_array',
:'namespace_string' => :'namespace_string',
:'namespace_number' => :'namespace_number',
:'namespace_integer' => :'namespace_integer',
:'namespace_boolean' => :'namespace_boolean',
:'namespace_array' => :'namespace_array',
:'namespace_wrapped_array' => :'namespace_wrapped_array',
:'prefix_ns_string' => :'prefix_ns_string',
:'prefix_ns_number' => :'prefix_ns_number',
:'prefix_ns_integer' => :'prefix_ns_integer',
:'prefix_ns_boolean' => :'prefix_ns_boolean',
:'prefix_ns_array' => :'prefix_ns_array',
:'prefix_ns_wrapped_array' => :'prefix_ns_wrapped_array'
}
end
# Attribute type mapping.
def self.openapi_types
{
:'attribute_string' => :'String',
:'attribute_number' => :'Float',
:'attribute_integer' => :'Integer',
:'attribute_boolean' => :'Boolean',
:'wrapped_array' => :'Array<Integer>',
:'name_string' => :'String',
:'name_number' => :'Float',
:'name_integer' => :'Integer',
:'name_boolean' => :'Boolean',
:'name_array' => :'Array<Integer>',
:'name_wrapped_array' => :'Array<Integer>',
:'prefix_string' => :'String',
:'prefix_number' => :'Float',
:'prefix_integer' => :'Integer',
:'prefix_boolean' => :'Boolean',
:'prefix_array' => :'Array<Integer>',
:'prefix_wrapped_array' => :'Array<Integer>',
:'namespace_string' => :'String',
:'namespace_number' => :'Float',
:'namespace_integer' => :'Integer',
:'namespace_boolean' => :'Boolean',
:'namespace_array' => :'Array<Integer>',
:'namespace_wrapped_array' => :'Array<Integer>',
:'prefix_ns_string' => :'String',
:'prefix_ns_number' => :'Float',
:'prefix_ns_integer' => :'Integer',
:'prefix_ns_boolean' => :'Boolean',
:'prefix_ns_array' => :'Array<Integer>',
:'prefix_ns_wrapped_array' => :'Array<Integer>'
}
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::XmlItem` 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::XmlItem`. 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?(:'attribute_string')
self.attribute_string = attributes[:'attribute_string']
end
if attributes.key?(:'attribute_number')
self.attribute_number = attributes[:'attribute_number']
end
if attributes.key?(:'attribute_integer')
self.attribute_integer = attributes[:'attribute_integer']
end
if attributes.key?(:'attribute_boolean')
self.attribute_boolean = attributes[:'attribute_boolean']
end
if attributes.key?(:'wrapped_array')
if (value = attributes[:'wrapped_array']).is_a?(Array)
self.wrapped_array = value
end
end
if attributes.key?(:'name_string')
self.name_string = attributes[:'name_string']
end
if attributes.key?(:'name_number')
self.name_number = attributes[:'name_number']
end
if attributes.key?(:'name_integer')
self.name_integer = attributes[:'name_integer']
end
if attributes.key?(:'name_boolean')
self.name_boolean = attributes[:'name_boolean']
end
if attributes.key?(:'name_array')
if (value = attributes[:'name_array']).is_a?(Array)
self.name_array = value
end
end
if attributes.key?(:'name_wrapped_array')
if (value = attributes[:'name_wrapped_array']).is_a?(Array)
self.name_wrapped_array = value
end
end
if attributes.key?(:'prefix_string')
self.prefix_string = attributes[:'prefix_string']
end
if attributes.key?(:'prefix_number')
self.prefix_number = attributes[:'prefix_number']
end
if attributes.key?(:'prefix_integer')
self.prefix_integer = attributes[:'prefix_integer']
end
if attributes.key?(:'prefix_boolean')
self.prefix_boolean = attributes[:'prefix_boolean']
end
if attributes.key?(:'prefix_array')
if (value = attributes[:'prefix_array']).is_a?(Array)
self.prefix_array = value
end
end
if attributes.key?(:'prefix_wrapped_array')
if (value = attributes[:'prefix_wrapped_array']).is_a?(Array)
self.prefix_wrapped_array = value
end
end
if attributes.key?(:'namespace_string')
self.namespace_string = attributes[:'namespace_string']
end
if attributes.key?(:'namespace_number')
self.namespace_number = attributes[:'namespace_number']
end
if attributes.key?(:'namespace_integer')
self.namespace_integer = attributes[:'namespace_integer']
end
if attributes.key?(:'namespace_boolean')
self.namespace_boolean = attributes[:'namespace_boolean']
end
if attributes.key?(:'namespace_array')
if (value = attributes[:'namespace_array']).is_a?(Array)
self.namespace_array = value
end
end
if attributes.key?(:'namespace_wrapped_array')
if (value = attributes[:'namespace_wrapped_array']).is_a?(Array)
self.namespace_wrapped_array = value
end
end
if attributes.key?(:'prefix_ns_string')
self.prefix_ns_string = attributes[:'prefix_ns_string']
end
if attributes.key?(:'prefix_ns_number')
self.prefix_ns_number = attributes[:'prefix_ns_number']
end
if attributes.key?(:'prefix_ns_integer')
self.prefix_ns_integer = attributes[:'prefix_ns_integer']
end
if attributes.key?(:'prefix_ns_boolean')
self.prefix_ns_boolean = attributes[:'prefix_ns_boolean']
end
if attributes.key?(:'prefix_ns_array')
if (value = attributes[:'prefix_ns_array']).is_a?(Array)
self.prefix_ns_array = value
end
end
if attributes.key?(:'prefix_ns_wrapped_array')
if (value = attributes[:'prefix_ns_wrapped_array']).is_a?(Array)
self.prefix_ns_wrapped_array = value
end
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 &&
attribute_string == o.attribute_string &&
attribute_number == o.attribute_number &&
attribute_integer == o.attribute_integer &&
attribute_boolean == o.attribute_boolean &&
wrapped_array == o.wrapped_array &&
name_string == o.name_string &&
name_number == o.name_number &&
name_integer == o.name_integer &&
name_boolean == o.name_boolean &&
name_array == o.name_array &&
name_wrapped_array == o.name_wrapped_array &&
prefix_string == o.prefix_string &&
prefix_number == o.prefix_number &&
prefix_integer == o.prefix_integer &&
prefix_boolean == o.prefix_boolean &&
prefix_array == o.prefix_array &&
prefix_wrapped_array == o.prefix_wrapped_array &&
namespace_string == o.namespace_string &&
namespace_number == o.namespace_number &&
namespace_integer == o.namespace_integer &&
namespace_boolean == o.namespace_boolean &&
namespace_array == o.namespace_array &&
namespace_wrapped_array == o.namespace_wrapped_array &&
prefix_ns_string == o.prefix_ns_string &&
prefix_ns_number == o.prefix_ns_number &&
prefix_ns_integer == o.prefix_ns_integer &&
prefix_ns_boolean == o.prefix_ns_boolean &&
prefix_ns_array == o.prefix_ns_array &&
prefix_ns_wrapped_array == o.prefix_ns_wrapped_array
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
[attribute_string, attribute_number, attribute_integer, attribute_boolean, wrapped_array, name_string, name_number, name_integer, name_boolean, name_array, name_wrapped_array, prefix_string, prefix_number, prefix_integer, prefix_boolean, prefix_array, prefix_wrapped_array, namespace_string, namespace_number, namespace_integer, namespace_boolean, namespace_array, namespace_wrapped_array, prefix_ns_string, prefix_ns_number, prefix_ns_integer, prefix_ns_boolean, prefix_ns_array, prefix_ns_wrapped_array].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 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 # or else data not found in attributes(hash), not an issue as the data can be optional
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 :DateTime
DateTime.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
Petstore.const_get(type).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

View File

@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.3-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@ -35,7 +35,7 @@ describe 'AnotherFakeApi' do
# unit tests for call_123_test_special_tags
# To test special tags
# To test special tags and operation ID starting with number
# @param body client model
# @param client client model
# @param [Hash] opts the optional parameters
# @return [Client]
describe 'call_123_test_special_tags test' do

View File

@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.3-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@ -32,13 +32,24 @@ describe 'FakeApi' do
end
end
# unit tests for create_xml_item
# creates an XmlItem
# this route creates an XmlItem
# @param xml_item XmlItem Body
# unit tests for fake_health_get
# Health check endpoint
# @param [Hash] opts the optional parameters
# @return [HealthCheckResult]
describe 'fake_health_get test' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
end
end
# unit tests for fake_http_signature_test
# test http signature authentication
# @param pet Pet object that needs to be added to the store
# @param [Hash] opts the optional parameters
# @option opts [String] :query_1 query parameter
# @option opts [String] :header_1 header parameter
# @return [nil]
describe 'create_xml_item test' do
describe 'fake_http_signature_test test' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
end
@ -58,7 +69,7 @@ describe 'FakeApi' do
# unit tests for fake_outer_composite_serialize
# Test serialization of object with outer number type
# @param [Hash] opts the optional parameters
# @option opts [OuterComposite] :body Input composite as post body
# @option opts [OuterComposite] :outer_composite Input composite as post body
# @return [OuterComposite]
describe 'fake_outer_composite_serialize test' do
it 'should work' do
@ -90,7 +101,7 @@ describe 'FakeApi' do
# unit tests for test_body_with_file_schema
# For this test, the body for this request much reference a schema named &#x60;File&#x60;.
# @param body
# @param file_schema_test_class
# @param [Hash] opts the optional parameters
# @return [nil]
describe 'test_body_with_file_schema test' do
@ -101,7 +112,7 @@ describe 'FakeApi' do
# unit tests for test_body_with_query_params
# @param query
# @param body
# @param user
# @param [Hash] opts the optional parameters
# @return [nil]
describe 'test_body_with_query_params test' do
@ -113,7 +124,7 @@ describe 'FakeApi' do
# unit tests for test_client_model
# To test \&quot;client\&quot; model
# To test \&quot;client\&quot; model
# @param body client model
# @param client client model
# @param [Hash] opts the optional parameters
# @return [Client]
describe 'test_client_model test' do
@ -185,7 +196,7 @@ describe 'FakeApi' do
# unit tests for test_inline_additional_properties
# test inline additionalProperties
# @param param request body
# @param request_body request body
# @param [Hash] opts the optional parameters
# @return [nil]
describe 'test_inline_additional_properties test' do

View File

@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.3-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@ -35,7 +35,7 @@ describe 'FakeClassnameTags123Api' do
# unit tests for test_classname
# To test class name in snake case
# To test class name in snake case
# @param body client model
# @param client client model
# @param [Hash] opts the optional parameters
# @return [Client]
describe 'test_classname test' do

View File

@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.3-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@ -34,7 +34,7 @@ describe 'PetApi' do
# unit tests for add_pet
# Add a new pet to the store
# @param body Pet object that needs to be added to the store
# @param pet Pet object that needs to be added to the store
# @param [Hash] opts the optional parameters
# @return [nil]
describe 'add_pet test' do
@ -93,7 +93,7 @@ describe 'PetApi' do
# unit tests for update_pet
# Update an existing pet
# @param body Pet object that needs to be added to the store
# @param pet Pet object that needs to be added to the store
# @param [Hash] opts the optional parameters
# @return [nil]
describe 'update_pet test' do

View File

@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.3-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@ -69,7 +69,7 @@ describe 'StoreApi' do
# unit tests for place_order
# Place an order for a pet
# @param body order placed for purchasing the pet
# @param order order placed for purchasing the pet
# @param [Hash] opts the optional parameters
# @return [Order]
describe 'place_order test' do

View File

@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.3-SNAPSHOT
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
@ -35,7 +35,7 @@ describe 'UserApi' do
# unit tests for create_user
# Create user
# This can only be done by the logged in user.
# @param body Created user object
# @param user Created user object
# @param [Hash] opts the optional parameters
# @return [nil]
describe 'create_user test' do
@ -46,7 +46,7 @@ describe 'UserApi' do
# unit tests for create_users_with_array_input
# Creates list of users with given input array
# @param body List of user object
# @param user List of user object
# @param [Hash] opts the optional parameters
# @return [nil]
describe 'create_users_with_array_input test' do
@ -57,7 +57,7 @@ describe 'UserApi' do
# unit tests for create_users_with_list_input
# Creates list of users with given input array
# @param body List of user object
# @param user List of user object
# @param [Hash] opts the optional parameters
# @return [nil]
describe 'create_users_with_list_input test' do
@ -115,7 +115,7 @@ describe 'UserApi' do
# Updated user
# This can only be done by the logged in user.
# @param username name that need to be deleted
# @param body Updated user object
# @param user Updated user object
# @param [Hash] opts the optional parameters
# @return [nil]
describe 'update_user test' do

View File

@ -1,41 +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: 4.1.3-SNAPSHOT
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for Petstore::AdditionalPropertiesAnyType
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe 'AdditionalPropertiesAnyType' do
before do
# run before each test
@instance = Petstore::AdditionalPropertiesAnyType.new
end
after do
# run after each test
end
describe 'test an instance of AdditionalPropertiesAnyType' do
it 'should create an instance of AdditionalPropertiesAnyType' do
expect(@instance).to be_instance_of(Petstore::AdditionalPropertiesAnyType)
end
end
describe 'test attribute "name"' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
end
end
end

Some files were not shown because too many files have changed in this diff Show More