Skip to content

Commit

Permalink
[Ruby] openapi_nullable as a Set and skipping attrs fix
Browse files Browse the repository at this point in the history
  • Loading branch information
slemrmartin committed Nov 6, 2019
1 parent a2cfa44 commit ccc0f79
Show file tree
Hide file tree
Showing 178 changed files with 1,264 additions and 556 deletions.
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? && !self.class.openapi_nullable.include?(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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@

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

{{#anyOf}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def self.openapi_types

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

# Initializes the object
Expand Down Expand Up @@ -175,7 +175,11 @@ def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil? && !self.class.openapi_nullable.include?(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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def self.openapi_types

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

# Initializes the object
Expand Down Expand Up @@ -175,7 +175,11 @@ def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil? && !self.class.openapi_nullable.include?(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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def self.openapi_types

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

# Initializes the object
Expand Down Expand Up @@ -175,7 +175,11 @@ def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil? && !self.class.openapi_nullable.include?(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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ def self.openapi_types

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

# Initializes the object
Expand Down Expand Up @@ -281,7 +281,11 @@ def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil? && !self.class.openapi_nullable.include?(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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def self.openapi_types

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

# Initializes the object
Expand Down Expand Up @@ -175,7 +175,11 @@ def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil? && !self.class.openapi_nullable.include?(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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def self.openapi_types

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

# Initializes the object
Expand Down Expand Up @@ -175,7 +175,11 @@ def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil? && !self.class.openapi_nullable.include?(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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def self.openapi_types

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

# Initializes the object
Expand Down Expand Up @@ -175,7 +175,11 @@ def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil? && !self.class.openapi_nullable.include?(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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def self.openapi_types

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

# Initializes the object
Expand Down Expand Up @@ -175,7 +175,11 @@ def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil? && !self.class.openapi_nullable.include?(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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def self.openapi_types

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

# discriminator's property name in OpenAPI v3
Expand Down Expand Up @@ -196,7 +196,11 @@ def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil? && !self.class.openapi_nullable.include?(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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def self.openapi_types

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

# Initializes the object
Expand Down Expand Up @@ -193,7 +193,11 @@ def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil? && !self.class.openapi_nullable.include?(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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def self.openapi_types

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

# Initializes the object
Expand Down Expand Up @@ -177,7 +177,11 @@ def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil? && !self.class.openapi_nullable.include?(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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def self.openapi_types

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

# Initializes the object
Expand Down Expand Up @@ -177,7 +177,11 @@ def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil? && !self.class.openapi_nullable.include?(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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def self.openapi_types

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

# Initializes the object
Expand Down Expand Up @@ -199,7 +199,11 @@ def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil? && !self.class.openapi_nullable.include?(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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def self.openapi_types

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

# Initializes the object
Expand Down Expand Up @@ -221,7 +221,11 @@ def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil? && !self.class.openapi_nullable.include?(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
Expand Down
10 changes: 7 additions & 3 deletions samples/client/petstore/ruby-faraday/lib/petstore/models/cat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def self.openapi_types

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

# List of class defined in allOf (OpenAPI v3)
Expand Down Expand Up @@ -187,7 +187,11 @@ def to_hash
hash = super
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil? && !self.class.openapi_nullable.include?(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
Expand Down
Loading

0 comments on commit ccc0f79

Please sign in to comment.