feat(expr): JSON-pointer sub-access on $inputs and $steps references - #90
Merged
Conversation
expr.Parse accepts the #/<json-pointer> suffix the spec's examples apply to $inputs and $steps output references (e.g. $steps.someStepId.outputs.pets#/0/id), and the generators translate it with strategies verified against the real tools. In Hurl, a sub-accessed step output becomes a derived capture at the producing step, folding the pointer into the source jsonpath: placeholder member access on a structured capture is unrenderable and placeholder filters are silently ignored (both verified empirically against hurl 8.0.1), so render-time navigation is impossible and $inputs sub-access stays explicitly flagged there. In k6, step outputs are parsed JSON constants navigated with bracket chains (string indices work on arrays), and $inputs sub-access goes through a per-reference asJson helper so a whole-value use of the same input keeps its raw string. The hurlgen internals move onto a translator struct carrying the derived-capture plan produced by a pre-scan of the workflow (post-replacement payloads, unresolved reusable parameters excluded, workflow-invoking steps skipped); derived names are collision-checked against declared captures. The linter's $steps regex now accepts inner dots in output names per the spec's name pattern (leading/trailing dots excluded to avoid swallowing prose punctuation), and a dotted-name miss whose first segment is a declared output gets a hint pointing at the #/<json-pointer> form.
The stdlib advisory GO-2026-5856 (Encrypted Client Hello privacy leak in crypto/tls, fixed in go1.25.12) fails govulncheck on every PR; CI reads the version from go.mod.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #49, the last open
spec-complianceissue.What
The spec's runtime-expression examples apply
#/<json-pointer>sub-access to step outputs ($steps.someStepId.outputs.pets#/0/id) and inputs; those references used to ship verbatim into generated tests. They are now translated, with every strategy validated against the real tools before implementation:Parseaccepts the pointer suffix on$inputsand$steps...outputsreferences (a bare#keeps whole-value semantics;#xstays unrecognised).list_body_items_0_id: jsonpath "$.items[0].id"), with collision-safe naming. This is the only strategy that works: probing hurl 8.0.1 showed that member access on a structured capture is unrenderable at run time and that placeholder filters parse but are silently ignored (the raw variable is rendered), which would have produced silently wrong requests.list_pets["0"]["id"]; string indices address arrays in JS).asJson()helper parses string values on use, so an input referenced both whole and sub-accessed keeps its raw string for the whole-value use (no module-init parse, no mixed-use corruption).$stepsoutput names may contain inner dots per the spec's name pattern; a dotted-name miss whose first segment IS a declared output now hints at the#/<json-pointer>form.Verification
GET /products/{$steps.list.outputs.body#/items/0/id}executed against the local mock: 100% pass in Hurl; k6 script validated withk6 archiveand navigates the parsed value.scripts/hurl-demoonly);make lint dist hurl perfon all examples with byte-identicalexamples/generated; e2e on the mock 100% pass.