oxidecomputer / typify

compiler from JSON Schema into idiomatic Rust types
Apache License 2.0
451 stars 60 forks source link

Hit panic in `add_type` #661

Open aatifsyed opened 3 months ago

aatifsyed commented 3 months ago

I am writing a codegen tool for non-rust users, and I fall afoul of this unwrap:

https://github.com/oxidecomputer/typify/blob/ebdee8c4a68dbe9351c58614330724e8ced1fda8/typify-impl/src/type_entry.rs#L234

It would be great to propagate errors to library users, so that I can tell my users what changes their spec requires.

Here's an abridged stack trace:

     4: typify_impl::type_entry::TypeEntryStruct::from_metadata
     5: typify_impl::convert::<impl typify_impl::TypeSpace>::convert_object
     6: typify_impl::convert::<impl typify_impl::TypeSpace>::convert_schema_object
     7: typify_impl::convert::<impl typify_impl::TypeSpace>::convert_schema_object
     8: typify_impl::convert::<impl typify_impl::TypeSpace>::convert_schema
     9: typify_impl::TypeSpace::id_for_schema
    10: typify_impl::TypeSpace::add_type_with_name
    11: typify_impl::TypeSpace::add_type