Skip to content

v1.24.7

Compare
Choose a tag to compare
@styra-bot styra-bot released this 23 Aug 20:31
· 12 commits to main since this release
148e1d5

OPA v0.67.1
Regal v0.25.0

This patch contains a new optional field for Batch Query API requests: common_input.
This field allows factoring out common top-level keys in an input object, which can greatly reduce request sizes in some cases.

Here is an example:

{
  "inputs": {
    "A": {
      "user": "alice",
      "action": "write",
    },
    "B": {
      "user": "bob"
    },
    "C": {
      "user": "eve"
    }
  },
  "common_input": {
    "action": "read",
    "object": "id1234"
  }
}

The above request using common_input is equivalent to sending this request:

{
  "inputs": {
    "A": {
      "user": "alice",
      "action": "write",
      "object": "id1234"
    },
    "B": {
      "user": "bob",
      "action": "read",
      "object": "id1234"
    },
    "C": {
      "user": "eve",
      "action": "read",
      "object": "id1234"
    }
  }
}

Conflict resolution

In cases where the types are both JSON Objects, the objects' top-level keys will be merged non-recursively.
In the event of a conflict where both common_input and the per-query input have the same key, the per-query input's key/value pair is used, as shown in the earlier example where common_input provides the "action": "read" key/value pair, and query "A" provides "action": "write" for the same top-level key/value pair.

In cases where the common_input's type conflicts with that of the per-query input, the per-query input value is used.

Example:

{
  "inputs": {
    "A": [1, 2, 3]
  },
  "common_input": {
    "foo": "bar"
  }
}

The above example is equivalent to the following request, because the input type overrides:

{
  "inputs": {
    "A": [1, 2, 3]
  }
}