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

Option to validate templates using jinja2schema #99

Open
jayvdb opened this issue Dec 5, 2018 · 1 comment
Open

Option to validate templates using jinja2schema #99

jayvdb opened this issue Dec 5, 2018 · 1 comment
Milestone

Comments

@jayvdb
Copy link
Collaborator

jayvdb commented Dec 5, 2018

https://github.com/aromanovich/jinja2schema can be used to determine all of the variables used in jinja2 templates . It is far from complete. There are enhancements in PRs, and forks , such as https://github.com/brkastner/jinja2schema and https://github.com/jayvdb/jinja2schema .

It can be used (for basic template) to verify that the templates only use variables which are supplied by statik, and that the assumed type of the jinja2 variable in the template is the same as the type of exposed by statik.

This option would fail for more complicated templates, as a result of its imperfections, but these will spur on development of jinja2schema . If jinja2schema raises an exception on a template, the exception needs to be caught , logged as a warning, and ignored, as it is likely the library that is at fault rather than the template.

It must be an optional feature so that it can be turned off whenever doesnt raise an exception but does incorrectly determine the type of a variable.

@jayvdb jayvdb changed the title Option to validate views using jinja2schema Option to validate templates using jinja2schema Dec 5, 2018
@jayvdb
Copy link
Collaborator Author

jayvdb commented Dec 11, 2018

Here is a script I have been working on to add jinja schema support to moban

https://gitlab.com/jayvdb/mobans/commit/3eedcea1ec450599de08b9c3f7cb91739f2acef6

kx-chen added a commit to kx-chen/statik that referenced this issue Dec 12, 2018
Use jinja2schema to validate templates when --validate-templates
is passed in.

Closes thanethomson#99
kx-chen added a commit to kx-chen/statik that referenced this issue Dec 12, 2018
Use jinja2schema to validate templates when --validate-templates
is passed in.

Closes thanethomson#99
kx-chen added a commit to kx-chen/statik that referenced this issue Dec 12, 2018
Use jinja2schema to validate templates when --validate-templates
is passed in.

Closes thanethomson#99
kx-chen added a commit to kx-chen/statik that referenced this issue Dec 12, 2018
Use jinja2schema to validate templates when --validate-templates
is passed in.

Closes thanethomson#99
kx-chen added a commit to kx-chen/statik that referenced this issue Dec 12, 2018
Use jinja2schema to validate templates when --validate-templates
is passed in.

Closes thanethomson#99
kx-chen added a commit to kx-chen/statik that referenced this issue Dec 15, 2018
Use jinja2schema to validate templates when --validate-templates
is passed in.

Closes thanethomson#99
kx-chen added a commit to kx-chen/statik that referenced this issue Dec 18, 2018
Use jinja2schema to validate templates when --validate-templates
is passed in.

Closes thanethomson#99
@thanethomson thanethomson added this to the v0.23.0 milestone Jan 13, 2019
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

No branches or pull requests

2 participants