-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
fear(api): wip refactor liquid parser #7280
base: next
Are you sure you want to change the base?
fear(api): wip refactor liquid parser #7280
Conversation
✅ Deploy Preview for dev-web-novu ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Hey there and thank you for opening this pull request! 👋 We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted. Your PR title is: Details: Unknown release type "fear" found in pull request title "fear(api): wip refactor liquid parser". Available types:
|
✅ Deploy Preview for dashboard-v2-novu-staging ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
const INVALID_VARIABLE_PLACEHOLDER = '<INVALID_VARIABLE_PLACEHOLDER>'; | ||
const PREVIEW_ERROR_MESSAGE_PLACEHOLDER = `[[Invalid Variable: ${INVALID_VARIABLE_PLACEHOLDER}]]`; |
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 am open to error message suggestions :)
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.
Now, the liquid parser is aware of the Novu-supported variables, and it passes it to its client.
if (keys.length === 1) { | ||
return; | ||
} |
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 solves cases if user provides the following control value:
{{subscriber}} {{subscriber.firstName}}
in such case API would trow 500 TypeError: Cannot create property 'firstName' on string '{{subscriber}}'
What changed? Why was the change needed?
this PR solves the issue that was raised, but there are still issues with the preview we will need to solve. i was not able to solve anything that was happening in PrepareAndValidateContentUsecase, because changing one issue caused another.
here is a summery i was able to do while working on this ticket:
{{subscriber}}
{{subscriber}} {{subscriber.firstName}}
TypeError: Cannot create property 'firstName' on string '{{subscriber}}'
.{{subscriber asd}}
{{payload..name | upcase}}
BridgeRequestError: Workflow with id: asd-opyf has invalid controls syntax in step with id: in-app-step. Please correct step control syntax.
(Liquid.js fails to parse invalid template output.){{payload | upcase}}
[OBJECT OBJECT]
.payload
variable. In the pipeline,payload: {}
is passed, and Liquid.js outputs{}.toString()
.- SOLVED: Now replaced with text ([[Invalid Variable: ...]]).
{{payload.name ca}}
{{payload.name ca | upcase}}
payload.name
variable. Since the variable is not provided, it renders nothing.{{payload}} or {{payload adasds}}
Example of before
After
Expand for optional sections
Related enterprise PR
Special notes for your reviewer