pub enum ControlValue {
Choice {
option: OptionId,
},
Text {
text: String,
},
Toggle {
on: bool,
},
Secret {
reference: SecretRef,
},
}Expand description
What was submitted for one control, typed.
Typed at the TYPE rather than at a downstream parser: a String here
would make every consumer decide whether "TRUE", "1", and "yes"
are the same toggle, which is the per-surface drift the epic exists to
end. Canonicalization lives in the shape, so A3 revalidates rather than
re-parses.
Deliberately NOT #[non_exhaustive], unlike the open vocabularies in
this crate (InteractionKind, SemanticRole, Audience, …). This
variant set is a security boundary: “no variant can carry a secret” is
provable only by an exhaustive match, and #[non_exhaustive] would
force every such match to end in a wildcard — after which adding a
plaintext-carrying variant would compile silently everywhere. Adding a
variant here SHOULD break every consumer that reasons about the set.
Every variant is a STRUCT variant: serde’s internally-tagged form
cannot represent a newtype variant wrapping a primitive, and the named
field is the clearer thing to freeze into A2.1’s vectors anyway
({"kind":"toggle","on":true}).
Variants§
Choice
One of the control’s options was chosen.
Fields
option: OptionIdWhich OPTION of the control named by the enclosing
Submission. A distinct id space from ControlId, so the
pair cannot name two things of the same kind with no rule
saying which wins. Its charset is enforced on construction AND
on deserialization, so the guarantee holds on the wire too.
Text
Free text, as typed.
Toggle
A boolean. Travels as a bool, never as text.
Secret
A secret, BY REFERENCE. There is deliberately no variant that can hold plaintext.