-
-
Notifications
You must be signed in to change notification settings - Fork 171
Implement new JSON Jinja filters #617
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
Conversation
docs/source/reference/jinja.rst
Outdated
| v2.1, the expression to access key ``foo`` from datastore used to be ``{{ system.foo }}`` | ||
| but is now deprecated, and the leading ``st2kv.`` namespace is required. | ||
|
|
||
| Currently, all data in the datastore is represented as strings. Toto represent |
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.
Toto -> To typo
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.
Fixed, thanks!
docs/source/reference/jinja.rst
Outdated
| # {'first': 'Jacob', 'last': 'e'}, | ||
| # {'first': 'Jayden', 'last': 'f'}]} | ||
| # result = ['James', 'Jacob', 'Jayden'] | ||
| {{ input | jmespath_query('people[*].first') }} |
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.
I think for such complex filter we need several more examples to show how powerful it is.
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.
Good idea! Added more examples.
arm4b
left a comment
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.
LGTM 👍
| # | ||
| # input = {'animals': ['bird', 'rabbit', 'cat', 'dog', 'cow'] } | ||
| # result = ['bird', 'rabbit', 'cat', 'dog', 'cow'] | ||
| {{ input | jsonpath_query('animals[*]') }} |
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.
Nice work on the docs and examples 👍
| .. code-block:: bash | ||
| {{version | version_strip_patch}} | ||
| {{ version | version_strip_patch }} |
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.
Thanks, I'm also not a fan of non-whitespace approach :P
This is the corresponding PR to
StackStorm/st2#3766 that adds documentation on the new filters.