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

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

View Spectral Equivalent

View Function Source