You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reference-able content blocks, defined on the root level of the codebase, need to access specific data points from the context. The content block might not know the exact keys available in the context, making the logic inside the block fragile and error-prone. This makes block reuse difficult.
The blocks that allow vars blocks (content, document, section blocks) and that can be referenced, should be able to declare the requirements: a list of variables a block expects to find in the context during execution.
Design
We introduce a new arrtibute to the content, document and section blocks:
required_vars -- (optional) a list of strings
required_vars defines the names of the variables that the block expectes to find in the context under .vars namespace.
Background
The reference-able
content
blocks, defined on the root level of the codebase, need to access specific data points from the context. The content block might not know the exact keys available in the context, making the logic inside the block fragile and error-prone. This makes block reuse difficult.The blocks that allow
vars
blocks (content
,document
,section
blocks) and that can be referenced, should be able to declare the requirements: a list of variables a block expects to find in the context during execution.Design
We introduce a new arrtibute to the
content
,document
andsection
blocks:required_vars
-- (optional) a list of stringsrequired_vars
defines the names of the variables that the block expectes to find in the context under.vars
namespace.For example:
renders into
while
throws an error saying that
content.text.hello
block requiresname
var which is not set.required_vars
is optional -- if not set in the block, the block behaves as it does currentlyNote: Required variables should be asserted after all vars / attributes in
ref
block are resolved.References
vars
block #166The text was updated successfully, but these errors were encountered: