lib/cocina/generator/schema_value.rb in cocina-models-0.58.2 vs lib/cocina/generator/schema_value.rb in cocina-models-0.59.0

- old
+ new

@@ -5,17 +5,17 @@ # Class for generating from an openapi value class SchemaValue < SchemaBase # rubocop:disable Layout/LineLength def generate # optional has to come before default or the default value that gets set will be nil. - "#{description}#{example}attribute :#{name.camelize(:lower)}, Types::#{dry_datatype(schema_doc)}#{optional}#{default}#{enum}#{omittable}" + "#{description}#{example}#{relaxed_comment}attribute :#{name.camelize(:lower)}, Types::#{dry_datatype(schema_doc)}#{optional}#{default}#{enum}#{omittable}" end # rubocop:enable Layout/LineLength private def enum - return '' unless schema_doc.enum + return '' if !schema_doc.enum || relaxed items = use_types? ? "*#{parent.name}::TYPES" : schema_doc.enum.map { |item| quote(item) }.join(', ') ".enum(#{items})" end