pub fn generate_models(spec: &Spec, names: &TypeNames) -> Result<Module>Expand description
Lower every component schema in spec into a module of Rust items.
names holds the final Rust type name of every schema, from
crate::lower::rename::type_renames. The caller resolves the names first,
because it also applies them to the service and decides when to report an
unresolved collision. A module built from unchecked names can hold two items
with one name, so the caller must check names before the emit pass.
One bad schema does not stop the loop. Component schemas are independent of each other, so a fault in one says nothing about the next. The pass lowers them all and reports every fault together, and the author makes one pass over the document instead of one for each fault. A schema that fails contributes no item, and the module is dropped, because the collected faults end the run.