Skip to content
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

jinja2.meta.find_undeclared_variables equivalent #248

Closed
morenol opened this issue Apr 21, 2023 · 4 comments · Fixed by #250
Closed

jinja2.meta.find_undeclared_variables equivalent #248

morenol opened this issue Apr 21, 2023 · 4 comments · Fixed by #250

Comments

@morenol
Copy link
Contributor

morenol commented Apr 21, 2023

http://code.nabla.net/doc/jinja2/api/jinja2/meta/jinja2.meta.find_undeclared_variables.html

I see that it was implemented but removed in #105

With the custom delimiters feature in place, maybe you could consider PRs adding that feature again?

@mitsuhiko
Copy link
Owner

Very possible to bring it back. I think the bigger question is what you want to use it for so I better understand the motivation.

@morenol
Copy link
Contributor Author

morenol commented Apr 23, 2023

My use case is something like:

given:


   - uses: actions/checkout@v3
      with:
        github-token: ${{ secrets.GITHUB_TOKEN }}

Get all the things that I need to have in context so it can render successfully. So, in this case secrets.GITHUB_TOKEN.

I see that the python library does not have a way to do it (nested undefined variables). Maybe I need to create something like jsonschema on top of minijinja.

In any case, thanks for bringing back that api again

@mitsuhiko
Copy link
Owner

For what it’s worth it doesn’t do anything for nested constant attribute access.

@mitsuhiko mitsuhiko reopened this Apr 25, 2023
@mitsuhiko
Copy link
Owner

I'm still not sure about the usefulness of this in the current form. Potentially the nested attribute information would make this at least somewhat more useful. Before releasing I want to reconsider this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants