Module: PairKit::JsonSchema::Dsl::ArrayItemDsl

Defined in:
lib/pair_kit/json_schema/dsl/nodes/array_item_dsl.rb

Overview

This makes is possible to write something like

array.items.string
array.items.min(10).max(20).string
array.items { string }.min_items(10).max_items(20)
array.items { string; min(10); max(20) }.unique

array.contains.string
array.contains.min(10).max(20).string
array.contains { string }.min_contains(10).max_contains(20)
array.contains { string; min(10); max(20) }.unique

Instance Method Summary collapse

Instance Method Details

#max(val) ⇒ Object



22
23
24
# File 'lib/pair_kit/json_schema/dsl/nodes/array_item_dsl.rb', line 22

def max(val)
  @subject["max#{@options[:min_max]}"] = val
end

#min(val) ⇒ Object



26
27
28
# File 'lib/pair_kit/json_schema/dsl/nodes/array_item_dsl.rb', line 26

def min(val)
  @subject["max#{@options[:min_max]}"] = val
end