tablo_core/declaration/
action_input.rs1use std::fmt;
4
5#[derive(Debug, Clone, PartialEq, Eq)]
8#[non_exhaustive]
9pub enum ActionInputFault {
10 ReservedField(String),
15 FileField(String),
19 RefusesEmpty,
23 DependentChoice(String),
27}
28
29pub(super) fn fmt_action_input(
31 f: &mut fmt::Formatter<'_>,
32 action: &str,
33 fault: &ActionInputFault,
34) -> fmt::Result {
35 match fault {
36 ActionInputFault::ReservedField(field) => write!(
37 f,
38 "action '{action}' declares an input field named '{field}', which its POST \
39 carries itself: rename the field"
40 ),
41 ActionInputFault::FileField(field) => write!(
42 f,
43 "action '{action}' declares a file field '{field}' in its input, which an \
44 action's POST does not upload: take the file in a record form"
45 ),
46 ActionInputFault::RefusesEmpty => write!(
47 f,
48 "action '{action}' declares no input field, but its input refuses an empty \
49 submission: declare the fields it parses, or name `()`"
50 ),
51 ActionInputFault::DependentChoice(field) => write!(
52 f,
53 "action '{action}' declares a dependent choice '{field}' in its input, whose \
54 options only a resource's form refreshes: drop `depends_on`"
55 ),
56 }
57}