Module: PairKit::JsonSchema::Dsl::ArrayDsl

Includes:
CommonPartialDsl
Defined in:
lib/pair_kit/json_schema/dsl/nodes/array_dsl.rb

Instance Method Summary collapse

Methods included from NullPartialDsl

#null

Methods included from StructuralPartialDsl

#_else, #_if, #_not, #_then, #all_of, #any_of, #one_of

Methods included from EnumPartialDsl

#enum

Methods included from ConstPartialDsl

#const

Methods included from MetaDataPartialDsl

#default, #deprecated, #description, #example, #read_only, #readable, #title, #writable, #write_only

Methods included from CorePartialDsl

#anchor, #comment, #define, #dynamic_anchor, #dynamic_ref, #id, #ref, #schema, #vocabulary

Instance Method Details

#contains(&block) ⇒ Object



19
20
21
# File 'lib/pair_kit/json_schema/dsl/nodes/array_dsl.rb', line 19

def contains(&block)
  @dsl.call(@subject, builder: :array_item, name: 'contains', min_max: 'Contains', &block)
end

#duplicated_itemsObject



43
44
45
# File 'lib/pair_kit/json_schema/dsl/nodes/array_dsl.rb', line 43

def duplicated_items
  @subject['uniqueItems'] = false
end

#items(&block) ⇒ Object



10
11
12
# File 'lib/pair_kit/json_schema/dsl/nodes/array_dsl.rb', line 10

def items(&block)
  @dsl.call(@subject, builder: :array_item, name: 'items', min_max: 'Items', &block)
end

#max_contains(val) ⇒ Object



31
32
33
# File 'lib/pair_kit/json_schema/dsl/nodes/array_dsl.rb', line 31

def max_contains(val)
  @subject['maxContains'] = val
end

#max_items(val) ⇒ Object



27
28
29
# File 'lib/pair_kit/json_schema/dsl/nodes/array_dsl.rb', line 27

def max_items(val)
  @subject['maxItems'] = val
end

#min_contains(val) ⇒ Object



35
36
37
# File 'lib/pair_kit/json_schema/dsl/nodes/array_dsl.rb', line 35

def min_contains(val)
  @subject['minContains'] = val
end

#min_items(val) ⇒ Object



23
24
25
# File 'lib/pair_kit/json_schema/dsl/nodes/array_dsl.rb', line 23

def min_items(val)
  @subject['minItems'] = val
end

#prefix_item(&block) ⇒ Object



14
15
16
17
# File 'lib/pair_kit/json_schema/dsl/nodes/array_dsl.rb', line 14

def prefix_item(&block)
  subject['prefixItems', []] << {}
  @dsl.call(@subject['prefixItems'].last, builder: :schema, &block)
end

#unique_itemsObject



39
40
41
# File 'lib/pair_kit/json_schema/dsl/nodes/array_dsl.rb', line 39

def unique_items
  @subject['uniqueItems'] = true
end