From 40af005f55e1c6f6083c063f07d8ef474fee935f Mon Sep 17 00:00:00 2001 From: Brooklyn Zelenka Date: Thu, 4 Jul 2024 12:24:34 -0700 Subject: [PATCH] Clarify difference from jq --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9f63fec..e470c0f 100644 --- a/README.md +++ b/README.md @@ -323,8 +323,6 @@ Any selection MAY begin and/or end with a single dot. Multiple dots (e.g. `..`, The try operator is idempotent, and repeated tries (`.foo???`) MUST be treated as a single one. -[jq] is a much larger language, and includes additional features like pipes, arithmatic, regexes, assignment, recursive descent, and so on which MUST NOT be supported in the UCAN Policy language. - For example, consider the following `args` from an `Invocation`: ``` json @@ -427,6 +425,12 @@ null +### Differences from jq + +[jq] is a much larger language than UCAN's selectors. jq includes features like pipes, arithmatic, regexes, assignment, recursive descent, and so on which MUST NOT be supported in the UCAN Policy language. + +jq produces streams of values, in contract to UCAN argument selectors which return an IPLD value. This introduces the primary difference between jq and UCAN argument selectors is how to treat output of the try (`?`) operator: UCAN's `try` selector operator MUST return `null` for the failure case. + ## Validation Validation involves substituting the values from the `args` field into the Policy, and evaluating the predicate. Since Policies are tree structured, selector substitution and predicate evaluation MAY proceed in any order.