pub struct Schema {
pub args: Vec<ArgSpec>,
pub options: BTreeMap<String, OptionSpec>,
pub strict: bool,
}Expand description
The schema declared inline in a sub-command’s fdl.yaml. Maps 1:1 to
what <entry> --fdl-schema will later emit as JSON.
Fields§
§args: Vec<ArgSpec>§options: BTreeMap<String, OptionSpec>§strict: boolWhen true, the fdl layer rejects options not declared in the schema before the sub-command’s entry ever runs. Two validation points:
- Load time — preset
options:maps are checked against the enclosingschema.options(seevalidate_presets_strict). A typo likeoptions: { batchsize: 32 }when the schema declaresbatch-sizeis a loud load error. - Dispatch time — the user’s extra argv tail is tokenized
against the schema (see
validate_tail). Unknown flags error out with a “did you mean” suggestion instead of being silently forwarded.
Validation NOT gated by strict — always-on for declared
items, so positive assertions from the schema always hold:
choices:on options: the user’s value and any preset YAML value must be in the list.choices:on positional args: the user’s value must be in the list (when strict is off, this may mis-fire if unknown flags push orphan values into positional slots — opt into strict for clean positional handling).
strict is purely about unknown options/args, not about
validating declared contracts.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Schema
impl<'de> Deserialize<'de> for Schema
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Schema
impl RefUnwindSafe for Schema
impl Send for Schema
impl Sync for Schema
impl Unpin for Schema
impl UnsafeUnpin for Schema
impl UnwindSafe for Schema
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more