-
Notifications
You must be signed in to change notification settings - Fork 277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSONSelection
refactoring, $variable
syntax, and an extensive new README.md
#5142
Conversation
CI performance tests
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is awesome!
quick non-blocking Q: $args
and $this
are not "special" — you can use any identifier in a VarPath, right? i think that's the right move, and we'll have semantic validation that disallows things like $foo
in a different part of the code?
This will allow me to reorganize the Selection-related code into separate modules, with a README and (eventually) a path to publishing this code as a standalone crate.
@lennyburdette Yep, As for validation, referring to undefined variables (or undefined paths like |
9adc0f6
to
42a076c
Compare
Cool, that makes sense. It'll be fun for us (@dylan-apollo) to make static validation match the ApplyTo runtime behavior |
I went ahead and merged this after @lennyburdette's review, since it's vulnerable to merge conflicts and I've been rebasing frequently. I don't mean to shut down discussion or comments from the other reviewers, or anyone who has thoughts/questions. |
Now that the implementation of the
JSONSelection
syntax lives in this repository, I've taken the time to reorganize the singleselection_parser.rs
file into a directory calledjson_selection
containing amod.rs
file, with the various components are split out into separate files.Most importantly, I've also written almost 4500 words in a comprehensive new
README.md
that lives in thejson_selection
directory. Please make time to read this documentation to understand the current version of the syntax.As explained in
README.md
, I added support for$variable
expressions, which will eventually support the$this
and$args
namespaces, as well as a special$
variable that always refers to the current value being processed. TheREADME.md
also describes->
method syntax, which will be useful for arbitrary inline data transformations, but I have not yet added support for that feature to the implementation. TheJSLiteral
and related grammar rules are only used with->
method syntax, so you can ignore them for now.An important change since the previous version of the
JSONSelection
syntax is that leading.
characters are no longer required forPathSelection
chains. This means you can writepost.author.name
instead of.post.author.name
(though the latter is still supported for backwards compatibility). When you need to express aPathSelection
consisting of a single key, you can now write$.data
instead of.data
, taking advantage of the new$
variable.Now that this code lives in the same repository with other code that uses it, I was able to update all existing consumption sites to accommodate my various renamings (like
Selection
toJSONSelection
, andProperty
toKey
), but if you have outstanding PRs or branches that you're working on, you may encounter some minor rebase conflicts. Let me know if anything I've changed is confusing.