Skip to content

Conversation

RemiBardon
Copy link
Member

Do not render templates referencing undefined props. See stepci/stepci#220 for a use case explanation.

@mishushakov
Copy link
Member

This is a weird behaviour. Liquid, which was the inspiration for this project just returns empty string:

https://liquidjs.com/playground.html#PHA+SGVsbG8sIHt7dGVzdH19IDwvcD4K,e30=

@RemiBardon
Copy link
Member Author

I understand but at the same time there is no way to achieve the opposite behavior (not rendering a template). To get an empty string of the variable is not defined I'd expect the use of a filter like | default or something like that.

@RemiBardon
Copy link
Member Author

Another solution for the $ref use case could be to render all children of $ref keys. That wouldn't require changing how liquidless works. I just thought about this, tell me if you'd prefer this solution.

@RemiBardon
Copy link
Member Author

I just realized that while the solution I had proposed (and implemented) works, it does not work with recursive $refs. I had made an optimization on a project where a openapi.json file contained { "$ref": "http://${{ env.host }}/api-docs/openapi.json" } so the file would be resolved only once when running the tests, but it doesn't work in this scenario. I don't know how we could fix this though.

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.

2 participants