You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(schema): expose the serde aliases the exported schema was hiding (#423)
schemars does not emit #[serde(alias = ...)]: it writes only the
canonical name. Every aliased spelling was therefore declared invalid by
`rustmotion schema` while the engine accepts it perfectly -- and the
exported schema is the file a generator reads to know what to write.
Two mechanisms, both post-processed after generation:
- variant aliases widen the `enum` array they belong to: float_3d,
progress_bar, flex-start/flex_start, flex-end/flex_end,
space-between/around/evenly.
- field aliases add a property mirroring the canonical one's schema.
BorderRadius is the case: its corners are declared as top-left and
carry alias = "top_left", and the branch is deny_unknown_fields, so a
scenario written the snake_case way was rejected outright.
The tables are keyed by definition name, not by value. Keying by value
would have been shorter and wrong: another enum with a `start` variant
and no aliases would have inherited spellings the engine rejects, which
turns a false negative into a false positive.
Drift is covered by reading the sources rather than trusting the table:
every_serde_alias_in_the_sources_is_reachable_from_the_exported_schema
scans every .rs for `alias = "..."` and fails naming any that the
exported schema does not contain. A new alias therefore fails CI instead
of quietly falling out of the schema.
Proven on minimal documents, since the examples are too noisy to isolate
it: a scenario using `float_3d` or `progress_bar` was rejected by the
exported schema and is accepted now.
What this does not fix, and what the issue attributed to it: the
repository's examples still fail schema validation, 62 paths before and
after. Their causes are elsewhere -- templating placeholders ($delay,
$d) are not modelled as anything but numbers, and Draft-7 anyOf
reporting picks an arbitrary branch, so the messages name the wrong
variant. Filed separately.
0 commit comments