Module: PairKit::JsonSchema::Dsl::MetaDataPartialDsl

Included in:
CommonPartialDsl
Defined in:
lib/pair_kit/json_schema/dsl/partials/meta_data_partial_dsl.rb

Overview

Instance Method Summary collapse

Instance Method Details

#default(val) ⇒ Object



16
17
18
# File 'lib/pair_kit/json_schema/dsl/partials/meta_data_partial_dsl.rb', line 16

def default(val)
  @subject['default'] = val
end

#deprecatedObject



20
21
22
# File 'lib/pair_kit/json_schema/dsl/partials/meta_data_partial_dsl.rb', line 20

def deprecated
  @subject['deprecated'] = true
end

#description(description = nil, &block) ⇒ Object



12
13
14
# File 'lib/pair_kit/json_schema/dsl/partials/meta_data_partial_dsl.rb', line 12

def description(description = nil, &block)
  @subject['description'] = description || block&.call
end

#example(example = nil, &block) ⇒ Object



24
25
26
# File 'lib/pair_kit/json_schema/dsl/partials/meta_data_partial_dsl.rb', line 24

def example(example = nil,  &block)
  @subject['examples', []]  << example || block&.call
end

#read_onlyObject



28
29
30
# File 'lib/pair_kit/json_schema/dsl/partials/meta_data_partial_dsl.rb', line 28

def read_only
  @subject['readOnly'] = true
end

#readableObject



40
41
42
# File 'lib/pair_kit/json_schema/dsl/partials/meta_data_partial_dsl.rb', line 40

def readable
  @subject['writeOnly'] = false
end

#title(title) ⇒ Object



8
9
10
# File 'lib/pair_kit/json_schema/dsl/partials/meta_data_partial_dsl.rb', line 8

def title(title)
  @subject['title'] = title
end

#writableObject



32
33
34
# File 'lib/pair_kit/json_schema/dsl/partials/meta_data_partial_dsl.rb', line 32

def writable
  @subject['readOnly'] = false
end

#write_onlyObject



36
37
38
# File 'lib/pair_kit/json_schema/dsl/partials/meta_data_partial_dsl.rb', line 36

def write_only
  @subject['writeOnly'] = true
end