forked from loafle/openapi-generator-original
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:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user