Scope Proposal #11
Closed
TotalTechGeek
started this conversation in
Ideas
Replies: 1 comment
-
I believe I'll be closing this proposal and introducing a new one, based on misc discussions we've had in different threads. |
Beta Was this translation helpful? Give feedback.
0 replies
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
-
Background
One undefined behavior in JSON Logic is how you should access context from outer scopes when working with scope introduced by an iterator.
This prevents you from using
filter
using an item stored in your context, or adding the index / a value from your context within a map statement.See:
Suggestion
The
json-logic-engine
implementation resolves it in the following way:What if we use directory style traversal to allow folks to reference outer scopes?
../
would go up a layer.So to reference the index of an iterator, you'd reach into the iterator's scope with
../index
.And to reference the context above the iterator, to fetch a property like
name
you'd climb up two levels,../../name
.Proposed Test Suite
Beta Was this translation helpful? Give feedback.
All reactions