Resolves a template a step's settings hold (a Respond body or header,
a Fail message) against the exchange view (Plugin.Location.view/0),
the way a Rewrite value is resolved (Plugin.Variables.resolve/2):
${var.<name>} from the view's variables (${var.<name>.<path>} a value inside one), ${error.<name>} from the
error a catch or On error handles, ${steps.<id>.<output>} from the
view's step outputs (Plugin.StepOutputs, with an optional key or
path after it), ${input.<name>} from the inputs of the call the
pipeline runs in (Pipelines.CallInputs), and the request's ${method},
${path}, ${client_ip}, ${request_id} and ${timestamp}, a value
of the pipeline's path template, ${path.<name>} (Pipelines.PathParams),
and
${allowed_methods} (Pipelines.AllowedMethods); and
the tenant's variables, {{NAME}} and {{secret.NAME}}, from the view's
tenant_vars (Pipelines.TenantVars), which the runner puts on the view
of a step that references one.
A secret reference is checked and left as written: the value goes in
where the request leaves the proxy (Pipelines.WireSecrets). Options:
allow_secret?: false refuses a secret reference (a template whose
result goes to the client or into an error). A reference that does not
resolve raises Plugin.UnresolvedVariableError.
A ${…} the resolver does not know is left as written, so a typo
(${vars.x} for ${var.x}) would reach the wire as text. check/1
finds those, with the reference it most likely meant, for the save to
refuse in the texts a plugin's exchange_templates/1 lists.
Summary
Functions
:ok, or {:error, message} naming the first ${…} in text that no
template resolves, with the reference it most likely meant when there is
one. A reference is judged by its name or namespace; of ${error.…} by
its field too, since the other namespaces take names only the pipeline
knows. A {{…}} tenant variable is not looked at: it is checked where it
resolves.
The template resolved against view; a template without ${ or {{ comes back as it is.
The names a template takes whole, the prefixes it takes before a dot,
and the fields of ${error.…}.
Functions
:ok, or {:error, message} naming the first ${…} in text that no
template resolves, with the reference it most likely meant when there is
one. A reference is judged by its name or namespace; of ${error.…} by
its field too, since the other namespaces take names only the pipeline
knows. A {{…}} tenant variable is not looked at: it is checked where it
resolves.
The template resolved against view; a template without ${ or {{ comes back as it is.
@spec vocabulary() :: %{ facts: [String.t()], namespaces: [String.t()], error_fields: [String.t()] }
The names a template takes whole, the prefixes it takes before a dot,
and the fields of ${error.…}.