Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codegen fails for Up OpenAPI client #694

Closed
opeik opened this issue Jan 18, 2024 · 2 comments
Closed

Codegen fails for Up OpenAPI client #694

opeik opened this issue Jan 18, 2024 · 2 comments

Comments

@opeik
Copy link

opeik commented Jan 18, 2024

Hi there!

I tried to generate a client for the Up OpenAPI spec which fails:

❯ cargo install cargo-progenitor
    Updating crates.io index
     Ignored package `cargo-progenitor v0.4.1` is already installed, use --force to override
    
❯ RUST_BACKTRACE=1 cargo progenitor --input up_openapi_spec.json --output up --name up --version
 0.1.0
gen fail: UnexpectedFormat("path /accounts is missing operation ID")
Error: generation experienced errors

Stack backtrace:
   0: std::backtrace_rs::backtrace::libunwind::trace
             at /rustc/a2d9d73e608f1b24eba840c4fd2d68dbe3b65e01/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1: std::backtrace_rs::backtrace::trace_unsynchronized
             at /rustc/a2d9d73e608f1b24eba840c4fd2d68dbe3b65e01/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2: std::backtrace::Backtrace::create
             at /rustc/a2d9d73e608f1b24eba840c4fd2d68dbe3b65e01/library/std/src/backtrace.rs:331:13
   3: anyhow::error::<impl anyhow::Error>::msg
   4: cargo_progenitor::main
   5: std::sys_common::backtrace::__rust_begin_short_backtrace
   6: std::rt::lang_start::{{closure}}
   7: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
             at /rustc/a2d9d73e608f1b24eba840c4fd2d68dbe3b65e01/library/core/src/ops/function.rs:284:13
   8: std::panicking::try::do_call
             at /rustc/a2d9d73e608f1b24eba840c4fd2d68dbe3b65e01/library/std/src/panicking.rs:554:40
   9: std::panicking::try
             at /rustc/a2d9d73e608f1b24eba840c4fd2d68dbe3b65e01/library/std/src/panicking.rs:518:19
  10: std::panic::catch_unwind
             at /rustc/a2d9d73e608f1b24eba840c4fd2d68dbe3b65e01/library/std/src/panic.rs:142:14
  11: std::rt::lang_start_internal::{{closure}}
             at /rustc/a2d9d73e608f1b24eba840c4fd2d68dbe3b65e01/library/std/src/rt.rs:148:48
  12: std::panicking::try::do_call
             at /rustc/a2d9d73e608f1b24eba840c4fd2d68dbe3b65e01/library/std/src/panicking.rs:554:40
  13: std::panicking::try
             at /rustc/a2d9d73e608f1b24eba840c4fd2d68dbe3b65e01/library/std/src/panicking.rs:518:19
  14: std::panic::catch_unwind
             at /rustc/a2d9d73e608f1b24eba840c4fd2d68dbe3b65e01/library/std/src/panic.rs:142:14
  15: std::rt::lang_start_internal
             at /rustc/a2d9d73e608f1b24eba840c4fd2d68dbe3b65e01/library/std/src/rt.rs:148:20
  16: _main
@ahl
Copy link
Collaborator

ahl commented Jan 19, 2024

It looks like this document lack the operation_id field. While this is optional for OpenAPI, it's something progenitor requires as the basis for the method names in the generated client.

Progenitor could be extended to generate an operation name from the path and method, but we have no specific plans to do this. I would suggest modifying the OpenAPI document by hand or generating a json patch file that you apply before handing it to progenitor.

@ahl ahl closed this as completed Jan 19, 2024
@opeik
Copy link
Author

opeik commented Jan 31, 2024

Thank you 🙇‍♀️ I'll give that a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants