lib/cocina/generator/schema_base.rb in cocina-models-0.30.0 vs lib/cocina/generator/schema_base.rb in cocina-models-0.31.0

- old
+ new

@@ -42,8 +42,30 @@ def example return '' unless schema_doc.example "# example: #{schema_doc.example}\n" end + + def dry_datatype(doc) + case doc.type + when 'integer' + 'Strict::Integer' + when 'string' + string_dry_datatype(doc) + when 'boolean' + 'Strict::Bool' + else + raise "#{schema_doc.type} not supported" + end + end + + def string_dry_datatype(doc) + case doc.format + when 'date-time' + 'Params::DateTime' + else + 'Strict::String' + end + end end end end