Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby client nullable #4391

Merged
merged 3 commits into from
Nov 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@
hash = {{^parent}}{}{{/parent}}{{#parent}}super{{/parent}}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@
}
end

# List of attributes with nullable: true
def self.openapi_nullable
Set.new([
{{#vars}}
{{#isNullable}}
:'{{{name}}}'{{#hasMore}},{{/hasMore}}
{{/isNullable}}
{{/vars}}
])
end

{{#anyOf}}
{{#-first}}
# List of class defined in anyOf (OpenAPI v3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ def self.openapi_types
}
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 = {})
Expand Down Expand Up @@ -169,7 +175,11 @@ def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ def self.openapi_types
}
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 = {})
Expand Down Expand Up @@ -169,7 +175,11 @@ def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ def self.openapi_types
}
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 = {})
Expand Down Expand Up @@ -169,7 +175,11 @@ def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ def self.openapi_types
}
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 = {})
Expand Down Expand Up @@ -275,7 +281,11 @@ def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ def self.openapi_types
}
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 = {})
Expand Down Expand Up @@ -169,7 +175,11 @@ def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ def self.openapi_types
}
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 = {})
Expand Down Expand Up @@ -169,7 +175,11 @@ def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ def self.openapi_types
}
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 = {})
Expand Down Expand Up @@ -169,7 +175,11 @@ def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ def self.openapi_types
}
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 = {})
Expand Down Expand Up @@ -169,7 +175,11 @@ def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ def self.openapi_types
}
end

# List of attributes with nullable: true
def self.openapi_nullable
Set.new([
])
end

# discriminator's property name in OpenAPI v3
def self.openapi_discriminator_name
:'class_name'
Expand Down Expand Up @@ -190,7 +196,11 @@ def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ def self.openapi_types
}
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 = {})
Expand Down Expand Up @@ -187,7 +193,11 @@ def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ def self.openapi_types
}
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 = {})
Expand Down Expand Up @@ -171,7 +177,11 @@ def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ def self.openapi_types
}
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 = {})
Expand Down Expand Up @@ -171,7 +177,11 @@ def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ def self.openapi_types
}
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 = {})
Expand Down Expand Up @@ -193,7 +199,11 @@ def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ def self.openapi_types
}
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 = {})
Expand Down Expand Up @@ -215,7 +221,11 @@ def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
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
Expand Down
Loading