Skip to main content

check_duplicate_models

Function check_duplicate_models 

Source
pub fn check_duplicate_models(module: &Module) -> Result<()>
Expand description

Fail generation if two items of module take one Rust type name.

TypeNames::check_emitted covers two component schemas that collapse onto one identifier. It cannot cover a hoisted inline schema, because such a schema has no name in components for the resolution pass to see. Lowering names a hoisted item after the property path that encloses it, so a component schema named after that same path takes the same name. The emitted item is what decides, so this check reads the final item names.

Every generation mode calls this check, including models-only generation.

ยงErrors

Returns one Error::DuplicateTypeName for a single duplicate name, or an Error::Validation that holds all of them.