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

Additional validate_heex func #7

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

alexandrexaviersm
Copy link
Contributor

@alexandrexaviersm alexandrexaviersm commented Mar 15, 2023

Add an additional validate_heex func that doesn't throw exceptions if the template is invalid.

I discussed it with Leandro and we thought it would be worth having a version of this function that doesn't throw exception when the template is invalid. We believe that it would be useful in some cases in Beacon, for example, right now I'm solving the issue BeaconCMS/beacon#74 and this function would be very handy to add the template error into an invalid changeset.

…onsistent

Co-authored-by: Leandro Pereira <leandro@leandro.io>
@alexandrexaviersm alexandrexaviersm force-pushed the feature/additional-validate_heex-function branch from df06b10 to c4a2ff0 Compare March 15, 2023 18:25
Comment on lines +30 to +33
quoted =
heex
|> HeexParser.parse_template()
|> validate_quoted(include_phoenix(opts))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets call directly into the other one, that way these two won't drift if a change is made to the parsing logic in one and doesn't get copied to the other version.

Suggested change
quoted =
heex
|> HeexParser.parse_template()
|> validate_quoted(include_phoenix(opts))
quoted = validate_heex!(heex, opts)

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 this pull request may close these issues.

3 participants