OpenAPITools / OpenAPITools/openapi-generator

[BUG] Cargo fails to compile. Using h2 0.2.7 causing compilation errors

Open
#12,154 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

When running cargo build I end up with:

   Compiling h2 v0.2.7
error[E0107]: this struct takes 3 generic arguments but 2 generic arguments were supplied
  --> /home/omar/.cargo/registry/src/github.com-1ecc6299db9ec823/h2-0.2.7/src/proto/streams/store.rs:15:10
   |
15 |     ids: IndexMap<StreamId, SlabIndex>,
   |          ^^^^^^^^ --------  --------- supplied 2 generic arguments
   |          |
   |          expected 3 generic arguments
   |
note: struct defined here, with 3 generic parameters: `K`, `V`, `S`
  --> /home/omar/.cargo/registry/src/github.com-1ecc6299db9ec823/indexmap-1.8.1/src/map.rs:76:12
   |
76 | pub struct IndexMap<K, V, S> {
   |            ^^^^^^^^ -  -  -
help: add missing generic argument
   |
15 |     ids: IndexMap<StreamId, SlabIndex, S>,
   |                                      +++

For more information about this error, try `rustc --explain E0107`.
error: could not compile `h2` due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed
openapi-generator version
openapi-generator-cli 5.4.0
  commit : unknown
  built  : -999999999-01-01T00:00:00+18:00
  source : https://github.com/openapitools/openapi-generator
  docs   : https://openapi-generator.tech/
Generation Details

Generation command: openapi-generator generate -g rust-server -i api.yml -o api_gen

Steps to reproduce
  1. Generate the code using previous command
  2. cd into api_gen
  3. Run cargo b
Suggest a fix

Change the package versions.

Contributor guide

Open the contributing guide

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

Generate the rust-server project with the shown command, then run cargo build and inspect the generated dependency declarations alongside the h2 v0.2.7 and indexmap v1.8.1 errors. Done means the generated project compiles successfully with compatible package versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.