Better allOf handling in fromProperty (#15035)

* fix allOf handling in fromProperty

* add null check, update samples

* update dart generator to handle allof with a single ref
This commit is contained in:
William Cheng
2023-03-26 15:06:27 +08:00
committed by GitHub
parent 56e5122a6a
commit a4dd90c01d
27 changed files with 129 additions and 37 deletions

View File

@@ -19,6 +19,28 @@ module Petstore
attr_accessor :single_ref_type
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
{