lib/cocina/generator/schema.rb in cocina-models-0.65.1 vs lib/cocina/generator/schema.rb in cocina-models-0.66.0
- old
+ new
@@ -14,15 +14,14 @@
module Cocina
module Models
class #{name} < Struct
+ #{validate}
#{types}
#{model_attributes}
-
- #{validate}
end
end
end
RUBY
end
@@ -62,13 +61,10 @@
def validate
return '' unless validatable?
<<~RUBY
- def self.new(attributes = default_attributes, safe = false, validate = true, &block)
- Validator.validate(self, attributes.with_indifferent_access) if validate && name
- super(attributes, safe, &block)
- end
+ include Validatable
RUBY
end
def validatable?
!schema_doc.node_context.document.paths["/validate/#{schema_doc.name}"].nil?