defined


defined will check that a given JSON Path exists and has been defined

The value can be anything, or it can be empty, as long as the key exists, this function will pass.

For a more complete function use truthy.

Example ruleset configuration

my-important-rule:
  message: "The thing should be defined"
  given: $.some.thing
  then:
    - field: chicken
      function: defined
    - field: nugget
      function: defined

View Spectral Equivalent


View Function Source