Expand description
The template language shared by webhook templates, provider definitions and gateways:
Jinja syntax on minijinja, with SendMock’s filters and functions
(12).
Structs§
- Rendered
Template - Standard
Template Functions - The time and random functions of 12, over the clock and random source so tests are deterministic.
- Template
Filter Entry - One filter as the reference documents it.
- Template
Problem
Enums§
- Template
Escape - How rendered values are written: as they are, or escaped for a place inside a JSON string, so a message body with quotes keeps a JSON answer valid.
- Template
Problem Severity - Template
Render Mode - Lenient renders an undefined value as nothing with a warning; strict stops with an error.
Constants§
- BUILTIN_
FILTER_ NAMES - The
minijinjabuilt-in filters templates may use, beside SendMock’s own. - FAKE_
METHOD_ NAMES - Every
fake.*method, asfake.<method>()in templates. - MAXIMUM_
RENDERED_ BYTES - The largest text one render may produce (1 MB), so a bad template cannot fill memory.
- POSTMAN_
ALIASES - Each Postman name and the expression it stands for.
- SENDMOCK_
FILTER_ NAMES - SendMock’s filters, registered in
template_environment. - TEMPLATE_
FILTER_ CATALOGUE - Every filter in
SENDMOCK_FILTER_NAMES, in the same order. - TEMPLATE_
FUEL_ LIMIT - Instructions one render may run, so a runaway loop stops instead of hanging a delivery.
Traits§
- Template
Functions - The functions a template may call, such as
uuid(). Keyword arguments arrive as one object after the positional ones.
Functions§
- evaluate_
template_ expression - Evaluates one expression, such as
data.to[0].address | lowerorrandom_int(1, 9), and keeps its type: a number stays a number and a list stays a list. A missing value is null. - generate_
uuid_ v4 - A version 4 UUID.
- render_
template - Renders leniently, as the UI preview does: an undefined value renders empty with a warning.
- render_
template_ in_ mode - Renders in a mode. Unknown names and unbalanced braces are found before rendering and stop it (the text is returned as written); a failed render returns no text.