Class: Cocina::Generator::SchemaValue
- Inherits:
-
SchemaBase
- Object
- SchemaBase
- Cocina::Generator::SchemaValue
- Defined in:
- lib/cocina/generator/schema_value.rb
Overview
Class for generating from an openapi value
Instance Attribute Summary
Attributes inherited from SchemaBase
#key, #nullable, #parent, #relaxed, #required, #schema_doc
Instance Method Summary collapse
-
#generate ⇒ Object
rubocop:disable Layout/LineLength.
Methods inherited from SchemaBase
#any_datatype?, #description, #dry_datatype, #example, #filename, #initialize, #name, #omittable, #optional, #quote, #relaxed_comment, #string_dry_datatype
Constructor Details
This class inherits a constructor from Cocina::Generator::SchemaBase
Instance Method Details
#generate ⇒ Object
rubocop:disable Layout/LineLength
8 9 10 11 |
# File 'lib/cocina/generator/schema_value.rb', line 8 def generate # optional has to come before default or the default value that gets set will be nil. "#{description}#{example}#{relaxed_comment}attribute :#{name.camelize(:lower)}, Types::#{dry_datatype(schema_doc)}#{optional}#{default}#{enum}#{omittable}" end |