What would you like to be added?
Specify how an OWS runtime must convert jq’s output stream into the single value expected by a runtime-expression field.
The specification requires jq support and describes an expression’s “result,” but jq filters can emit zero, one, or many values. Current implementations therefore make incompatible choices.
The clarification should cover:
- Zero emitted values.
- Multiple emitted values.
- The distinction between no output and JSON
null.
- Whether evaluation stops after selecting a result.
- Whether an error occurring after an emitted value must still fail evaluation.
Proposal(s)
Define runtime-expression evaluation as equivalent to:
with these rules:
| jq behavior |
OWS runtime-expression result |
| Emits one value |
Return that value |
| Emits multiple values |
Return the first value and stop evaluation |
| Emits no values |
Raise the standard expression error with status 400 |
Emits JSON null |
Return JSON null |
| Emits a value followed by an error |
Return the first value; the later error is not evaluated |
Examples:
Input: [1, 2, 3]
Expression: .[]
Result: 1
Expression: empty
Result: expression error
Expression: null
Result: null
Expression: 1, error("boom")
Result: 1
This provides a stable single-value contract without silently changing a scalar-producing expression into an array. It also preserves jq’s distinction between empty and null.
Add corresponding CTK scenarios so implementations produce portable results.
Alternative(s)
-
Require exactly one emitted value and raise an expression error for zero or multiple values.
-
Collect multiple values into an array and convert zero values to null. This resembles the Java SDK reference implementation, but implicitly changes the result type and makes empty indistinguishable from an emitted JSON null.
-
Preserve jq’s output stream. This would require defining stream handling independently for every OWS field that consumes a runtime expression.
Additional info
The OWS runtime-expression section requires jq support but does not define output cardinality.
The jq manual defines filters as generators: .[] can produce multiple results, while empty produces none.
The Java SDK’s JQExpression returns one emission directly, collects subsequent emissions into an array, and returns null when nothing is emitted. Other jq-based runtimes consume only the first emission and treat no emission as an error.
Without a normative rule and CTK coverage, the same valid workflow can produce different output or failure behavior across conforming runtimes.
Community Notes
- Please vote by adding a 👍 reaction to the feature to help us prioritize.
- If you are interested in working on this feature, please leave a comment.
What would you like to be added?
Specify how an OWS runtime must convert jq’s output stream into the single value expected by a runtime-expression field.
The specification requires jq support and describes an expression’s “result,” but jq filters can emit zero, one, or many values. Current implementations therefore make incompatible choices.
The clarification should cover:
null.Proposal(s)
Define runtime-expression evaluation as equivalent to:
with these rules:
400nullnullExamples:
This provides a stable single-value contract without silently changing a scalar-producing expression into an array. It also preserves jq’s distinction between
emptyandnull.Add corresponding CTK scenarios so implementations produce portable results.
Alternative(s)
Require exactly one emitted value and raise an expression error for zero or multiple values.
Collect multiple values into an array and convert zero values to
null. This resembles the Java SDK reference implementation, but implicitly changes the result type and makesemptyindistinguishable from an emitted JSONnull.Preserve jq’s output stream. This would require defining stream handling independently for every OWS field that consumes a runtime expression.
Additional info
The OWS runtime-expression section requires jq support but does not define output cardinality.
The jq manual defines filters as generators:
.[]can produce multiple results, whileemptyproduces none.The Java SDK’s
JQExpressionreturns one emission directly, collects subsequent emissions into an array, and returnsnullwhen nothing is emitted. Other jq-based runtimes consume only the first emission and treat no emission as an error.Without a normative rule and CTK coverage, the same valid workflow can produce different output or failure behavior across conforming runtimes.
Community Notes