Merge remote-tracking branch 'origin/5.3.x' into 6.0.x

This commit is contained in:
William Cheng
2021-07-27 11:52:19 +08:00
1011 changed files with 34058 additions and 5848 deletions

View File

@@ -19,6 +19,7 @@ docs/Category.md
docs/ClassModel.md
docs/Client.md
docs/DefaultApi.md
docs/DeprecatedObject.md
docs/Dog.md
docs/DogAllOf.md
docs/EnumArrays.md
@@ -41,6 +42,7 @@ docs/ModelReturn.md
docs/Name.md
docs/NullableClass.md
docs/NumberOnly.md
docs/ObjectWithDeprecatedFields.md
docs/Order.md
docs/OuterComposite.md
docs/OuterEnum.md
@@ -80,6 +82,7 @@ lib/petstore/models/cat_all_of.rb
lib/petstore/models/category.rb
lib/petstore/models/class_model.rb
lib/petstore/models/client.rb
lib/petstore/models/deprecated_object.rb
lib/petstore/models/dog.rb
lib/petstore/models/dog_all_of.rb
lib/petstore/models/enum_arrays.rb
@@ -100,6 +103,7 @@ 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/object_with_deprecated_fields.rb
lib/petstore/models/order.rb
lib/petstore/models/outer_composite.rb
lib/petstore/models/outer_enum.rb

View File

@@ -4,6 +4,9 @@ rvm:
- 2.3
- 2.4
- 2.5
- 2.6
- 2.7
- 3.0
script:
- bundle install --path vendor/bundle
- bundle exec rspec

View File

@@ -132,6 +132,7 @@ Class | Method | HTTP request | Description
- [Petstore::Category](docs/Category.md)
- [Petstore::ClassModel](docs/ClassModel.md)
- [Petstore::Client](docs/Client.md)
- [Petstore::DeprecatedObject](docs/DeprecatedObject.md)
- [Petstore::Dog](docs/Dog.md)
- [Petstore::DogAllOf](docs/DogAllOf.md)
- [Petstore::EnumArrays](docs/EnumArrays.md)
@@ -152,6 +153,7 @@ Class | Method | HTTP request | Description
- [Petstore::Name](docs/Name.md)
- [Petstore::NullableClass](docs/NullableClass.md)
- [Petstore::NumberOnly](docs/NumberOnly.md)
- [Petstore::ObjectWithDeprecatedFields](docs/ObjectWithDeprecatedFields.md)
- [Petstore::Order](docs/Order.md)
- [Petstore::OuterComposite](docs/OuterComposite.md)
- [Petstore::OuterEnum](docs/OuterEnum.md)

View File

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

View File

@@ -0,0 +1,24 @@
# Petstore::ObjectWithDeprecatedFields
## Properties
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **uuid** | **String** | | [optional] |
| **id** | **Float** | | [optional] |
| **deprecated_ref** | [**DeprecatedObject**](DeprecatedObject.md) | | [optional] |
| **bars** | **Array<String>** | | [optional] |
## Example
```ruby
require 'petstore'
instance = Petstore::ObjectWithDeprecatedFields.new(
uuid: null,
id: null,
deprecated_ref: null,
bars: null
)
```

View File

@@ -28,6 +28,7 @@ require 'petstore/models/cat_all_of'
require 'petstore/models/category'
require 'petstore/models/class_model'
require 'petstore/models/client'
require 'petstore/models/deprecated_object'
require 'petstore/models/dog_all_of'
require 'petstore/models/enum_arrays'
require 'petstore/models/enum_class'
@@ -47,6 +48,7 @@ require 'petstore/models/model_return'
require 'petstore/models/name'
require 'petstore/models/nullable_class'
require 'petstore/models/number_only'
require 'petstore/models/object_with_deprecated_fields'
require 'petstore/models/order'
require 'petstore/models/outer_composite'
require 'petstore/models/outer_enum'

View File

@@ -0,0 +1,218 @@
=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.3.0-SNAPSHOT
=end
require 'date'
require 'time'
module Petstore
class DeprecatedObject
attr_accessor :name
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'name' => :'name'
}
end
# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end
# Attribute type mapping.
def self.openapi_types
{
:'name' => :'String'
}
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::DeprecatedObject` 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::DeprecatedObject`. 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 attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
self.send("#{key}=", nil)
elsif type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the attribute
# is documented as an array but the input is not
if attributes[self.class.attribute_map[key]].is_a?(Array)
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
end
elsif !attributes[self.class.attribute_map[key]].nil?
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
end
end
self
end
# Deserializes the data based on type
# @param string type Data type
# @param string value Value to be deserialized
# @return [Object] Deserialized data
def _deserialize(type, value)
case type.to_sym
when :Time
Time.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :Boolean
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true
else
false
end
when :Object
# generic object (usually a Hash), return directly
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
# models (e.g. Pet) or oneOf
klass = Petstore.const_get(type)
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
end
end
# Returns the string representation of the object
# @return [String] String presentation of the object
def to_s
to_hash.to_s
end
# to_body is an alias to to_hash (backward compatibility)
# @return [Hash] Returns the object in the form of hash
def to_body
to_hash
end
# Returns the object in the form of hash
# @return [Hash] Returns the object in the form of hash
def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
if value.nil?
is_nullable = self.class.openapi_nullable.include?(attr)
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
end
hash[param] = _to_hash(value)
end
hash
end
# Outputs non-array value in the form of hash
# For object, use to_hash. Otherwise, just return the value
# @param [Object] value Any valid value
# @return [Hash] Returns the value in the form of hash
def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end
end
end

View File

@@ -0,0 +1,247 @@
=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.3.0-SNAPSHOT
=end
require 'date'
require 'time'
module Petstore
class ObjectWithDeprecatedFields
attr_accessor :uuid
attr_accessor :id
attr_accessor :deprecated_ref
attr_accessor :bars
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'uuid' => :'uuid',
:'id' => :'id',
:'deprecated_ref' => :'deprecatedRef',
:'bars' => :'bars'
}
end
# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end
# Attribute type mapping.
def self.openapi_types
{
:'uuid' => :'String',
:'id' => :'Float',
:'deprecated_ref' => :'DeprecatedObject',
:'bars' => :'Array<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::ObjectWithDeprecatedFields` 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::ObjectWithDeprecatedFields`. 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?(:'uuid')
self.uuid = attributes[:'uuid']
end
if attributes.key?(:'id')
self.id = attributes[:'id']
end
if attributes.key?(:'deprecated_ref')
self.deprecated_ref = attributes[:'deprecated_ref']
end
if attributes.key?(:'bars')
if (value = attributes[:'bars']).is_a?(Array)
self.bars = 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 &&
uuid == o.uuid &&
id == o.id &&
deprecated_ref == o.deprecated_ref &&
bars == o.bars
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
[uuid, id, deprecated_ref, bars].hash
end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def build_from_hash(attributes)
return nil unless attributes.is_a?(Hash)
self.class.openapi_types.each_pair do |key, type|
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
self.send("#{key}=", nil)
elsif type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the attribute
# is documented as an array but the input is not
if attributes[self.class.attribute_map[key]].is_a?(Array)
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
end
elsif !attributes[self.class.attribute_map[key]].nil?
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
end
end
self
end
# Deserializes the data based on type
# @param string type Data type
# @param string value Value to be deserialized
# @return [Object] Deserialized data
def _deserialize(type, value)
case type.to_sym
when :Time
Time.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :Boolean
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true
else
false
end
when :Object
# generic object (usually a Hash), return directly
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
# models (e.g. Pet) or oneOf
klass = Petstore.const_get(type)
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
end
end
# Returns the string representation of the object
# @return [String] String presentation of the object
def to_s
to_hash.to_s
end
# to_body is an alias to to_hash (backward compatibility)
# @return [Hash] Returns the object in the form of hash
def to_body
to_hash
end
# Returns the object in the form of hash
# @return [Hash] Returns the object in the form of hash
def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
if value.nil?
is_nullable = self.class.openapi_nullable.include?(attr)
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
end
hash[param] = _to_hash(value)
end
hash
end
# Outputs non-array value in the form of hash
# For object, use to_hash. Otherwise, just return the value
# @param [Object] value Any valid value
# @return [Hash] Returns the value in the form of hash
def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end
end
end

View File

@@ -0,0 +1,34 @@
=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.2.0-SNAPSHOT
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for Petstore::DeprecatedObject
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::DeprecatedObject do
let(:instance) { Petstore::DeprecatedObject.new }
describe 'test an instance of DeprecatedObject' do
it 'should create an instance of DeprecatedObject' do
expect(instance).to be_instance_of(Petstore::DeprecatedObject)
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

View File

@@ -0,0 +1,52 @@
=begin
#OpenAPI Petstore
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 5.2.0-SNAPSHOT
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for Petstore::ObjectWithDeprecatedFields
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe Petstore::ObjectWithDeprecatedFields do
let(:instance) { Petstore::ObjectWithDeprecatedFields.new }
describe 'test an instance of ObjectWithDeprecatedFields' do
it 'should create an instance of ObjectWithDeprecatedFields' do
expect(instance).to be_instance_of(Petstore::ObjectWithDeprecatedFields)
end
end
describe 'test attribute "uuid"' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
end
end
describe 'test attribute "id"' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
end
end
describe 'test attribute "deprecated_ref"' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
end
end
describe 'test attribute "bars"' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
end
end
end