The fetch and api_form elements (coupled with query/form api) are a powerful way to configure api read/write, because their data.action.parameters allows ($query, $user)-dependent api calls.
The block.expr configuration, on the other hand, allows merging a fetch's response into template blocks - it distinguishes the template blocks'data static, value-typed, configuration, from blocks'expr, mergeable, object-typed (all values can be strings) response-dependent configuration.
It also allows to merge expr using corresponding value from data like [$default]?id=[$item.id].
Currently, the same tool (the semafor expr mode) is used to declare:
data.action.parameters($query, $user) merged only in query/form server api
expr(response, $query) merged only by element-template render() method.
The problem is that the semafor expr mode is applied to all the data of the fetch/api_form schema, while it is actually meant to adapt only the service part (data.action.parameters, which depends on the value of data.action.method).
So it is quite simple to fix this:
change write's form "service" filter so it converts the service schema to an expr-style schema
disable semafor expr mode on fetch/api_form (unless they are actually inside a template, but even in that case, the expr mode should apply before the service filter)
The fetch and api_form elements (coupled with query/form api) are a powerful way to configure api read/write, because their data.action.parameters allows ($query, $user)-dependent api calls.
The
block.expr
configuration, on the other hand, allows merging a fetch's response into template blocks - it distinguishes the template blocks'data static, value-typed, configuration, from blocks'expr, mergeable, object-typed (all values can be strings) response-dependent configuration. It also allows to merge expr using corresponding value from data like[$default]?id=[$item.id]
.Currently, the same tool (the semafor expr mode) is used to declare:
The problem is that the semafor expr mode is applied to all the data of the fetch/api_form schema, while it is actually meant to adapt only the service part (data.action.parameters, which depends on the value of data.action.method).
So it is quite simple to fix this: