Bug Report: Progenitor panic during OpenAPI schema processing
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
使用附带的 openapi.json 重现 cargo progenitor 命令,然后检查 typify-impl/src/value.rs 第 168 行附近以及 typify-impl/src/type_entry.rs 第 281 行附近。跟踪经过 cargo-progenitor 和 progenitor_impl 的两条 panic 路径。完成的标准是 schema 在不触发这两个 panic 的情况下完成处理,并且 enum 变体能够唯一生成。
由索引模型根据 Issue 内容生成。
描述
Summary
Two distinct errors occur when using cargo-progenitor to generate Rust code from an OpenAPI schema:
- Internal Error: Unreachable code panic in
typify_implcrate - Enum Naming Conflict: Failure to generate unique enum variant names
Environment
- OS: macOS 15.3 (24D5034f)
- Rust Toolchain: rustc 1.87.0-nightly (be73c1f46 2025-03-21)
- Cargo: 1.87.0-nightly (6cf826701 2025-03-14)
- cargo-progenitor: Multiple versions tested(latest crates.io and github main)
Error 1: Internal Error (crates.io version)
Command
cargo progenitor -i openapi.json -o flashnet-api -n flashnet-api -v 0.1.0
Error Message
thread 'main' panicked at /path/to/typify-impl-0.3.0/src/value.rs:168:31:
internal error: entered unreachable code
Stack Trace
stack backtrace:
0: 0x1045c455c - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::he81ee2f6917ac346
1: 0x1045e1210 - core::fmt::write::hb8bd6ebe8d126f01
2: 0x1045c1c7c - std::io::Write::write_fmt::h231b749ddbdedad8
3: 0x1045c4410 - std::sys::backtrace::BacktraceLock::print::haa0f7dcd7d675535
4: 0x1045c52b0 - std::panicking::default_hook::{{closure}}::h348ab2736102eb75
5: 0x1045c5100 - std::panicking::default_hook::h511f34b773963527
6: 0x1045c5d90 - std::panicking::rust_panic_with_hook::h9212a4961c7816e2
7: 0x1045c5994 - std::panicking::begin_panic_handler::{{closure}}::h36c66d732862ba4e
8: 0x1045c4a0c - std::sys::backtrace::__rust_end_short_backtrace::h1a358ecd2efce9b5
9: 0x1045c5664 - __rustc[a9f817043035500e]::rust_begin_unwind
10: 0x1045fec28 - core::panicking::panic_fmt::h93d6168e6a972526
11: 0x1045fec98 - core::panicking::panic::h9bc603bd595e5787
12: 0x1043a515c - typify_impl::value::<impl typify_impl::type_entry::TypeEntry>::output_value::h371d1f35c6ab1e18
13: 0x1043a4a2c - typify_impl::value::<impl typify_impl::type_entry::TypeEntry>::output_value::h371d1f35c6ab1e18
14: 0x1043914f4 - typify_impl::defaults::<impl typify_impl::type_entry::TypeEntry>::default_fn::h636e061fb15039d5
15: 0x104422ad4 - typify_impl::structs::generate_serde_attr::ha08443aa691a3d0c
16: 0x104399254 - typify_impl::type_entry::TypeEntry::output_struct::hd9c1bedafb1bc337
17: 0x104393aac - typify_impl::type_entry::TypeEntry::output::h3aa954e680862016
18: 0x1043c1cf0 - typify_impl::TypeSpace::to_stream::h5159ab332df57e0c
19: 0x1042661bc - progenitor_impl::Generator::generate_tokens::h74316bf692ea8887
20: 0x1041ad3a4 - cargo_progenitor::main::h01165f9824f04b28
21: 0x1041f2704 - std::sys::backtrace::__rust_begin_short_backtrace::h229088e7ef092790
22: 0x1041d5870 - std::rt::lang_start::{{closure}}::h34f76fd4b2aa70a5
23: 0x1045bb998 - std::rt::lang_start_internal::h812ab8fe58e67928
24: 0x1041b2734 - _main
Error 2: Enum Naming Conflict (from github main)
Command
RUST_BACKTRACE=1 cargo progenitor -i openapi.json -o flashnet-api -n flashnet-api -v 0.1.0
Error Message
thread 'main' panicked at /Users/.cargo/git/checkouts/typify-854920f7bf9e46dd/4bffebf/typify-impl/src/type_entry.rs:281:13:
Failed to make unique variant names for [1m,1M]
Stack Trace
stack backtrace:
0: __rustc::rust_begin_unwind
1: core::panicking::panic_fmt
2: typify_impl::type_entry::TypeEntryEnum::from_metadata
3: typify_impl::convert::<impl typify_impl::TypeSpace>::convert_enum_string
4: typify_impl::convert::<impl typify_impl::TypeSpace>::convert_schema_object
5: typify_impl::convert::<impl typify_impl::TypeSpace>::convert_schema
6: typify_impl::TypeSpace::convert_ref_type
7: typify_impl::TypeSpace::add_ref_types
8: progenitor_impl::Generator::generate_tokens
9: cargo_progenitor::main
Affected Components
typify_implcargo-progenitorCLI tool- OpenAPI schema processing
- 主要语言
- Rust
- 星标
- 1k
- 派生
- 142
- 平均合并
- 19 小时 13 分钟
- 30 天内合并 PR
- 16
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
oxidecomputer/progenitor 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
oxidecomputer/progenitor#1345 ·
维护者通常 1 天内回复
-
Generated client treats a declared 304 Not Modified as UnexpectedResponse可能已有人在做 @jjant 于 6 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 25/100
oxidecomputer/progenitor#1462 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 58/100
oxidecomputer/progenitor#1457 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 55/100
oxidecomputer/progenitor#1444 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 68/100
oxidecomputer/progenitor#1382 ·
维护者通常 1 天内回复
查看 oxidecomputer/progenitor 的全部 Issue
相似的 Issue
-
[Bug]: Add Data's question says "Link to the file" for a GeoPackage where small tables are copied未关闭unconfirmed possible issue
难度 2/5 1-3 小时 新手友好度 64/100
维护者通常 1 天内回复
-
documentation
难度 2/5 1-3 小时 新手友好度 78/100
jerney-nexus/epikrise#364 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
Yeachan-Heo/gajae-code#8058 ·
维护者通常 1 天内回复
-
bug daemon
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
good first issue
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复