Class: Cocina::Generator::Schema
- Inherits:
-
SchemaBase
- Object
- SchemaBase
- Cocina::Generator::Schema
- Defined in:
- lib/cocina/generator/schema.rb
Overview
Class for generating from an openapi schema
Instance Attribute Summary
Attributes inherited from SchemaBase
#key, #parent, #required, #schema_doc
Instance Method Summary collapse
Methods inherited from SchemaBase
#description, #dry_datatype, #example, #filename, #initialize, #name, #omittable, #quote, #string_dry_datatype
Constructor Details
This class inherits a constructor from Cocina::Generator::SchemaBase
Instance Method Details
#generate ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/cocina/generator/schema.rb', line 11 def generate <<~RUBY # frozen_string_literal: true module Cocina module Models class #{name} < Struct #{types} #{model_attributes} #{validate} end end end RUBY end |
#schema_properties ⇒ Object
7 8 9 |
# File 'lib/cocina/generator/schema.rb', line 7 def schema_properties @schema_properties ||= (properties + all_of_properties).uniq(&:key) end |