Method: SimpleJSONSchema::Checker.required_keys

Defined in:
lib/simple_json_schema/checker.rb

.required_keys(scope) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/simple_json_schema/checker.rb', line 20

def required_keys(scope)
  required = scope[:required]
  return unless required.is_a?(Array)

  missing_keys = required - scope.value.keys
  scope.error(:required, missing_keys: missing_keys) if missing_keys.any?
end