openlang

How can I tell whether input was provided to a REGO policy?

How do I test whether input is present using REGO? I've found the following approach.

package sandbox

default present = false

present {
  input.payload
}

Is doing it this way correct? Could I use a better approach instead?

The conversation continues 2

Follow the reasoning
  1. Permalink

    package sandbox

    default supplied = false

    supplied {input["payload"]}

    The result is true when your input contains the 'payload' key . Otherwise the default value false is returned

Other sides of the same question

  1. Choosing enum entries randomly with GDScript in Godot 3.3 without listing each one?

    Here's the enum declaration I'm using in GDScript: I'd like to choose an enum variant randomly without listing every possible…

    Replies 2Latest activity gdscript
  2. Nim remainder syntax

    How is modulus expressed in Nim? cell % 7 == 0 gives undeclared identifier: '%' Neither a Google search nor looking through S…

    Replies 2Latest activity nim
  3. Returning results from an APL function

    How do I make my function return something once execution has finished? For instance, I have: ROUTINE N ? N ⍴ 12 //That gener…

    Replies 2Latest activity apl