values
Class info¶
Classes¶
| Name | Children | Inherits |
|---|---|---|
| FieldError promptantic.form.values Input that can't become a value of the field (e.g. "abc" for a number). |
🛈 DocStrings¶
Turning input into values, and checking a single field while it's being filled.
The whole value is validated at the end (:mod:promptantic.form.target); these
checks are what a renderer shows next to a field as the user types.
FieldError
¶
field_errors
¶
field_errors(node: FormNode, value: Any) -> list[str]
What's wrong with value for this field alone (empty when it fits).
Covers the field's own constraints (length, pattern, format, bounds, item and key counts, allowed choices); the full document is validated at the end.
Source code in src/promptantic/form/values.py
parse_text
¶
parse_text(node: StringNode | NumberNode | AnyNode, text: str) -> Any | Unset
The value typed text stands for; :data:UNSET for empty input.
Raises:
| Type | Description |
|---|---|
FieldError
|
|