Sha256: b61e89ab8e0b67f0e3918b2d93115d9e965913c890f189dc5339de23a1bedfd8

Contents?: true

Size: 407 Bytes

Versions: 1

Compression:

Stored size: 407 Bytes

Contents

# frozen_string_literal: true

module Cocina
  module Generator
    # Class for generating from an openapi array
    class SchemaArray < SchemaBase
      def generate
        "attribute :#{name.camelize(:lower)}, Types::Strict::Array.of(#{array_of_type}).default([])"
      end

      def array_of_type
        schema_doc.items.name || "Types::#{dry_datatype(schema_doc.items)}"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cocina-models-0.63.0 lib/cocina/generator/schema_array.rb