template_variable_schemas
Schemas for entries on the "template" tag of TemplateModellerConfig schemas.
Module
Functions
improve_template_variable_schema
def improve_template_variable_schema( spec_dict: dict[str, typing.Any],) ‑> dict[str, typing.Any]:Annotate template variable field so editors surface better hints.
This inspects the generated OpenAPI components and rewrites the template
field definition to differentiate between scalar types (where type is a
literal string) and nested types (where type is an object with a single key
such as model_slug). The resulting if/then/else schema allows tools such
as yaml-language-server to display the expected nested keys instead of only the
scalar literals.
validate_extension
def validate_extension(value: str | None) ‑> None:Validate that extension is either None or a string that does not start with '.'.
For instance, should be "csv", not ".csv".
Classes
TemplateVariablesEntryArray
class TemplateVariablesEntryArray( *, label: str, tooltip: str | None = None, type: Literal['array'], items: bitfount.runners.config_schemas.template_variable_schemas._TemplateArrayItemsDetails, minItems: int | None = None, default: Optional[list[str]] = None,):Represents a flat type: array template variable entry.
Attributes
label: Human-readable label for the variable (inherited).tooltip: Optional tooltip text for UI display (inherited).type: Must be "array".items: Item schema; strings only.minItems: Optional minimum number of items.default: Optional flat string list.Noneis allowed so the field can be left unset.
Variables
- static
default : Optional[list[str]]
- static
items : bitfount.runners.config_schemas.template_variable_schemas._TemplateArrayItemsDetails
- static
minItems : int | None
- static
type : Literal['array']
TemplateVariablesEntryBool
class TemplateVariablesEntryBool( *, label: str, tooltip: str | None = None, type: Literal['boolean'], default: Optional[bool] = None,):Represents a "type: boolean" template variable entry.
TemplateVariablesEntryFilePath
class TemplateVariablesEntryFilePath( *, label: str, tooltip: str | None = None, type: bitfount.runners.config_schemas.template_variable_schemas._TemplateFilePathTypeEntry, default: str | None = None,):Represents a "type: file_path" template variable entry.
Variables
- static
default : str | None
- static
type : bitfount.runners.config_schemas.template_variable_schemas._TemplateFilePathTypeEntry
TemplateVariablesEntryModelSlug
class TemplateVariablesEntryModelSlug( *, label: str, tooltip: str | None = None, type: bitfount.runners.config_schemas.template_variable_schemas._TemplateModelSlugTypeEntry,):Represents a "type: model_slug" template variable entry.
Variables
- static
type : bitfount.runners.config_schemas.template_variable_schemas._TemplateModelSlugTypeEntry
TemplateVariablesEntryNestedArray
class TemplateVariablesEntryNestedArray( *, label: str, tooltip: str | None = None, type: Literal['array'], items: bitfount.runners.config_schemas.template_variable_schemas._TemplateNestedArrayItemsDetails, minItems: int | None = None, default: Optional[list[list[str]]] = None,):Represents a nested string-array template variable entry.
type is still array; nesting is expressed by items.type: array.
Attributes
label: Human-readable label for the variable (inherited).tooltip: Optional tooltip text for UI display (inherited).type: Must be "array".items: Item schema; nested arrays of strings.minItems: Optional minimum number of outer items.default: Optional list of non-empty string lists.Noneis allowed so the field can be left unset.
Variables
- static
default : Optional[list[list[str]]]
- static
items : bitfount.runners.config_schemas.template_variable_schemas._TemplateNestedArrayItemsDetails
- static
minItems : int | None
- static
type : Literal['array']
TemplateVariablesEntryNumber
class TemplateVariablesEntryNumber( *, label: str, tooltip: str | None = None, type: Literal['number'], minimum: Union[int, float, ForwardRef(None)] = None, default: Union[int, float, ForwardRef(None)] = None,):Represents a "type: number" template variable entry.
Variables
- static
default : Union[int, float, ForwardRef(None)]
- static
minimum : Union[int, float, ForwardRef(None)]
- static
type : Literal['number']
TemplateVariablesEntryObject
class TemplateVariablesEntryObject( *, label: str, tooltip: str | None = None, type: Literal['object'], default: Optional[dict[str, typing.Any]] = None,):Represents a type: object template variable entry.
For a config field whose value is a structure rather than a scalar or a
string list — a criteria_tree, say. Substitution already supports this:
_replace_template_value_recursive replaces the whole "{{ var }}" string
node with the supplied value, whatever its type, rather than interpolating
into it. Only this declaration layer restricted the type.
The value is deliberately unvalidated here, beyond being an object. This
layer knows a variable is structured; it does not know
which structure, and duplicating (say) the criteria_tree node union into
the template vocabulary would mean two definitions of one shape that must
be kept in lockstep. The consuming config model validates it on parse, so a
malformed tree is still rejected before it can decide anything — with that
model's own error message, naming the offending node.
A UI cannot render a form field for an arbitrary object, so a variable
declared this way is expected to be set as YAML/JSON rather than through a
form — the structured counterpart to the column_criteria escape hatch the
v9 templates already document.
Attributes
label: Human-readable label for the variable (inherited).tooltip: Optional tooltip text for UI display (inherited).type: Must be "object".default: Optional default structure — one object, not a list of them.Noneis allowed, and is the normal default: a config field whose unset state isNonethen blanks correctly when the variable is left unset.
TemplateVariablesEntryObjectArray
class TemplateVariablesEntryObjectArray( *, label: str, tooltip: str | None = None, type: Literal['array'], items: bitfount.runners.config_schemas.template_variable_schemas._TemplateObjectArrayItemsDetails, minItems: int | None = None, default: Optional[list[dict[str, typing.Any]]] = None,):Represents a type: array entry whose items are objects.
For a config field typed as a list of structures rather than as one — the
patient_enrichment step's sources is a list[EnrichmentSource] | None.
type is still array, with the entry type in items, which is how the
string and nested-string lists spell themselves too. Declaring such a
variable type: object instead would say "object" in the schema about a
value that is an array, so a generated JSON Schema could not describe it.
Like TemplateVariablesEntryObject, the entries themselves are
unvalidated beyond being objects; the consuming config model checks what
they hold, and rejects a malformed entry with its own error.
Attributes
label: Human-readable label for the variable (inherited).tooltip: Optional tooltip text for UI display (inherited).type: Must be "array".items: Item schema; objects only.minItems: Optional minimum number of items.default: Optional list of objects.Noneis allowed so the field can be left unset, and is distinct from[]— a config field taking a list of structures can tell "no entries" from "unset".
Variables
- static
default : Optional[list[dict[str, typing.Any]]]
- static
items : bitfount.runners.config_schemas.template_variable_schemas._TemplateObjectArrayItemsDetails
- static
minItems : int | None
- static
type : Literal['array']
TemplateVariablesEntrySchemaColumnName
class TemplateVariablesEntrySchemaColumnName( *, label: str, tooltip: str | None = None, type: bitfount.runners.config_schemas.template_variable_schemas._TemplateSchemaColumnNameTypeEntry, default: str | None = None,):Represents a "type: schema_column_name" template variable entry.
Variables
- static
default : str | None
- static
type : bitfount.runners.config_schemas.template_variable_schemas._TemplateSchemaColumnNameTypeEntry
TemplateVariablesEntrySchemaColumnNameArray
class TemplateVariablesEntrySchemaColumnNameArray( *, label: str, tooltip: str | None = None, type: bitfount.runners.config_schemas.template_variable_schemas._TemplateSchemaColumnNameArrayTypeEntry, default: Optional[list[str]] = None,):Represents a "type: schema_column_name_array" template variable entry.
Variables
- static
default : Optional[list[str]]
- static
type : bitfount.runners.config_schemas.template_variable_schemas._TemplateSchemaColumnNameArrayTypeEntry
TemplateVariablesEntryString
class TemplateVariablesEntryString( *, label: str, tooltip: str | None = None, type: Literal['string'], pattern: str | None = None, default: str | None = None, minLength: int | None = 1, enum: Optional[list[str]] = None,):Represents a "type: string" template variable entry.
Attributes
label: Human-readable label for the variable (inherited).tooltip: Optional tooltip text for UI display (inherited).type: Must be "string".pattern: Optional regex pattern for validation.default: Optional default value. If enum is specified, must be in enum.minLength: Optional minimum string length.enum: Optional list of allowed values. When specified, only values in this list are valid. Used by frontends to render a dropdown selector.
Variables
- static
default : str | None
- static
enum : Optional[list[str]]
- static
minLength : int | None
- static
pattern : str | None
- static
type : Literal['string']
TemplateVariablesEntryTaskFilters
class TemplateVariablesEntryTaskFilters( *, label: str, tooltip: str | None = None, type: bitfount.runners.config_schemas.template_variable_schemas._TemplateTaskFiltersTypeEntry, default: Optional[list[dict[str, typing.Any]]] = None,):Represents a "type: task_filters" template variable entry.
Variables
- static
default : Optional[list[dict[str, typing.Any]]]
- static
type : bitfount.runners.config_schemas.template_variable_schemas._TemplateTaskFiltersTypeEntry
TemplatesMixin
class TemplatesMixin( template: Optional[dict[str, TemplateVariablesEntryString | TemplateVariablesEntryNumber | TemplateVariablesEntryNestedArray | TemplateVariablesEntryArray | TemplateVariablesEntryObject | TemplateVariablesEntryObjectArray | TemplateVariablesEntryFilePath | TemplateVariablesEntryModelSlug | TemplateVariablesEntrySchemaColumnName | TemplateVariablesEntrySchemaColumnNameArray | TemplateVariablesEntryBool | TemplateVariablesEntryTaskFilters]] = None,):Schema for schemas having a template field.
Subclasses
Variables
- static
template : Optional[dict[str, TemplateVariablesEntryString | TemplateVariablesEntryNumber | TemplateVariablesEntryNestedArray | TemplateVariablesEntryArray | TemplateVariablesEntryObject | TemplateVariablesEntryObjectArray | TemplateVariablesEntryFilePath | TemplateVariablesEntryModelSlug | TemplateVariablesEntrySchemaColumnName | TemplateVariablesEntrySchemaColumnNameArray | TemplateVariablesEntryBool | TemplateVariablesEntryTaskFilters]]