Class: Meta::JsonSchema::ArraySchemaBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/meta/json_schema/builders/array_schema_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(options, &block) ⇒ ArraySchemaBuilder

Returns a new instance of ArraySchemaBuilder.



6
7
8
9
10
11
12
13
14
# File 'lib/meta/json_schema/builders/array_schema_builder.rb', line 6

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

Instance Method Details

#object_property?(options, block) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/meta/json_schema/builders/array_schema_builder.rb', line 20

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

#to_schemaObject



16
17
18
# File 'lib/meta/json_schema/builders/array_schema_builder.rb', line 16

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