136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
# File 'lib/aspace_client/archivesspace_json_schema.rb', line 136
def self.validate(current_schema, data, fragments, validator, options = {})
enum_name = current_schema.schema['dynamic_enum']
if !JSONModel.init_args[:enum_source].valid?(enum_name, data)
possible_values = JSONModel.init_args[:enum_source].values_for(enum_name)
message = ("The property '#{build_fragment(fragments)}' value #{data.inspect} " +
"did not match one of the following configurable values: #{possible_values.join(', ')}")
if JSONModel.init_args[:enum_source].editable?(enum_name)
klass = self
else
klass = ArchivesSpaceReadOnlyDynamicEnumAttribute
end
validation_error(message, fragments, current_schema, klass, options[:record_errors])
end
end
|