Expand description
Resolution of top-level type names across the lowered IR.
A generated type name differs from the plain to_ident(schema_name) for two
reasons. The schema carries an x-rust-name override, or two schema names
collapse onto one Rust identifier and the config supplies a suffix. Every
reference to a schema lowers to a RustType::Named that holds the original
schema name. Name resolution therefore must also rewrite those references to
point at the final identifier. Lowering sets the item names from the same
resolution map. See crate::lower::schema. This pass rewrites the Named
references that still point at the original name.
An unresolved collision is not reported here. Default pruning drops a schema
that no operation uses, and a collision between two dropped schemas never
reaches the output. type_renames therefore returns the collisions it found,
and the caller reports them when the set of emitted models is final.
Structs§
- Type
Names - The final Rust type name of every top-level schema, together with each collision that still needs a decision from the author.
Functions§
- check_
duplicate_ models - Fail generation if two items of
moduletake one Rust type name. - check_
prelude_ shadowing - Fail generation if an emitted item takes the name of a prelude type that the file names without a path.
- check_
type_ name_ collisions - Fail generation if two items that the file holds take one Rust type name.
- rewrite_
module - Rewrite every
Namedreference inmodule’s items to honourrenames. - rewrite_
service - Rewrite every
Namedreference inservice’s operations to honourrenames. - type_
renames - Resolve the Rust type name of every top-level schema in
spec.