Sha256: d16248e82ad439ff51294597359698f1f0ed81bcb42348565c33b94be690114d

Contents?: true

Size: 707 Bytes

Versions: 10

Compression:

Stored size: 707 Bytes

Contents

# frozen_string_literal: true

module Meta
  module JsonSchema
    class ArraySchemaBuilder
      def initialize(options, &block)
        options = options.dup
        items_options = options.delete(:items) || {}
        items_options[:ref] = options.delete(:ref) if options[:ref]
        items_options[:dynamic_ref] = options.delete(:dynamic_ref) if options[:dynamic_ref]

        @items_schema = SchemaBuilderTool.build(items_options, &block)
        @base_options = options
      end

      def to_schema
        ArraySchema.new(@items_schema, @base_options)
      end

      def object_property?(options, block)
        (options && !options[:properties].nil?) || !block.nil?
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
meta-api-0.2.0 lib//meta/json_schema/builders/array_schema_builder.rb
meta-api-0.1.2 lib//meta/json_schema/builders/array_schema_builder.rb
meta-api-0.1.1 lib//meta/json_schema/builders/array_schema_builder.rb
meta-api-0.1.0 lib//meta/json_schema/builders/array_schema_builder.rb
meta-api-0.0.9 lib//meta/json_schema/builders/array_schema_builder.rb
meta-api-0.0.8 lib/meta/json_schema/builders/array_schema_builder.rb
meta-api-0.0.7 lib/meta/json_schema/builders/array_schema_builder.rb
meta-api-0.0.6 lib/meta/json_schema/builders/array_schema_builder.rb
meta-api-0.0.5 lib/meta/json_schema/builders/array_schema_builder.rb
meta-api-0.0.4 lib/meta/json_schema/builders/array_schema_builder.rb