Expand description
Checks a custom binding’s fields against the outputs schema its type’s descriptor carries.
The schemas come from utoipa, through the extension SDK: objects with properties and
required, $refs into $defs, oneOf for an optional struct, enum for a unit enum, and
the numeric and string bounds Rust’s types imply. The check reads exactly the keywords below.
A schema that uses any other keyword refuses the binding, naming the keyword, so a binding is
never accepted against a rule the check skipped.
One rule is stricter than JSON Schema: an object field its schema doesn’t name is refused
unless additionalProperties allows it, so a misspelled output is caught. A field one allOf
branch names, as #[serde(flatten)] writes, counts as named in every branch.
The check is hand-written rather than the jsonschema crate’s because alien-core builds for
wasm32-wasip1, and that crate pulls in reqwest, fancy-regex and idna.
Constants§
- FLATTENED_
MAP - Why
flattens_a_map_beside_fieldsrefuses an outputs schema. - FLATTENED_
OPTION - Why
flattens_alternativesrefuses an outputs schema.
Functions§
- flattens_
a_ map_ beside_ fields - Whether an outputs schema flattens a map beside a struct’s fields anywhere: utoipa writes it
as an
allOfwhere one branch allows any other field and another names its own. The check reads each branch alone, so the struct’s branch would refuse every key of the map. A struct that itself flattens a struct names its fields through its ownallOf, notproperties. - flattens_
alternatives - Whether an outputs schema flattens an
Optionor an enum anywhere: in the outputs or in any type they use. utoipa writes#[serde(flatten)] Option<S>as anallOfbranch with aoneOfof null andS, and a flattened enum as one with aoneOfof its variants. Which fields an object of it carries depends on the value, so the check can’t tell a misspelled field from one of them. - output_
names - The outputs a type’s outputs schema names, which a custom binding of the type carries as
fields: its root
propertiesand those of itsallOfbranches, through$refs, as#[serde(flatten)]writes them.