Add the optional argument fallback_policy
to the map_text
filter
#210
Labels
enhancement
New feature or request
Milestone
This PR describes the addition of a new optional argument to the
map_text
filter to define the behavior of this filter when an entry doesn’t exist in theweaver.yaml
config file.The
map_text
filter already supports the following arguments:map_text("<text_map_id>" [, "<default_value>"])
.This issue adds the concept of a fallback policy, defining more precisely the behavior of this filter when the input doesn't match any entries in the
text_maps
configuration.The new optional parameter
fallback_policy
will accept one of the three possible configurations:input
: When this behavior is set, and there is no entry matching the input, the input is returned by the filter. This was the behavior of the filter when no default value was provided.default
: When this behavior is set, and there is no entry matching the input, the default value is returned by the filter. This was the behavior of the filter when a default value was provided. Usingfallback_policy=default
and not providing adefault_value
is considered an error, and the filter will emit an error.error
: When this behavior is set, and there is no entry matching the input, the filter will emit an error. This specific configuration was not supported in the previous version of themap_text
filter.By making the fallback policy explicit, it is now possible, for example, to specify that we want to fail the doc/code generation if the text_map configuration is incomplete.
The text was updated successfully, but these errors were encountered: