oxidecomputer / oxidecomputer/progenitor

Panic while generating YNAB OpenAPI client

Open
#693 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1k
Forks
136
Avg merge
8h 36m
Merged PRs (30d)
14

Description

Hi there!

I tried to generate a client for the YNAB OpenAPI spec which seems to panic:

❯ 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 ynab_openapi_spec.yaml --output ynab --name ynab --v
ersion 0.1.0
thread 'main' panicked at /Users/opeik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/progenitor-impl-0.4.1/src/method.rs:1201:9:
assertion failed: response_types.len() <= 1
stack backtrace:
   0: rust_begin_unwind
             at /rustc/a2d9d73e608f1b24eba840c4fd2d68dbe3b65e01/library/std/src/panicking.rs:647:5
   1: core::panicking::panic_fmt
             at /rustc/a2d9d73e608f1b24eba840c4fd2d68dbe3b65e01/library/core/src/panicking.rs:72:14
   2: core::panicking::panic
             at /rustc/a2d9d73e608f1b24eba840c4fd2d68dbe3b65e01/library/core/src/panicking.rs:144:5
   3: progenitor_impl::method::<impl progenitor_impl::Generator>::extract_responses
   4: progenitor_impl::method::<impl progenitor_impl::Generator>::method_sig_body
   5: progenitor_impl::method::<impl progenitor_impl::Generator>::positional_method
   6: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
   7: core::iter::adapters::try_process
   8: progenitor_impl::Generator::generate_tokens
   9: cargo_progenitor::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the panic with cargo progenitor using the YNAB OpenAPI spec linked in the issue and the shown command. Start by examining extract_responses in progenitor-impl/src/method.rs around the response_types assertion. Done means the specification no longer causes a panic and client generation completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, rust
Domain
backend-api-design, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.