lib/cocina/generator/schema_value.rb in cocina-models-0.63.1 vs lib/cocina/generator/schema_value.rb in cocina-models-0.64.0
- old
+ new
@@ -24,13 +24,17 @@
def use_types?
parent.is_a?(Schema) && key == 'type'
end
def default
+ # Provide version as default for cocinaVersion
+ return '.default(Cocina::Models::VERSION)' if name == 'cocinaVersion'
+
# If type is boolean and default is false, erroneously getting a nil.
# Assuming that if required, then default is false.
default = schema_doc.default
default = false if default.nil? && schema_doc.type == 'boolean' && required
+
return '' if default.nil?
".default(#{quote(default)})"
end
end