OpenAPITools / OpenAPITools/openapi-generator

[REQ][RUST] Update template generated version of bon for option `useBonBuilder`

Open Beginner friendly
#24,312 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Is your feature request related to a problem? Please describe.

First up, thank you very much for all the work done on the specification and making this incredibly complex topic even possible to begin with

The rust generator config allow for optional use of the bon crate

This crate "provides idiomatic partial application with optional and named parameters for functions and methods".

The current version of bon generated is version 2.3.0 which is 2 years old with bon having made many improvements in the meantime.

Describe the solution you'd like

Update or remove pinning to current outdated version of bon

Describe alternatives you've considered

There also is the useSingleRequestParameter which groups all parameters into a single struct.

This is another popular approach to dealing with rusts explicit nature of having to supply ALL parameters even if they are supposed to be optionally unset.

With current rust the approach would be:

struct someParams {
  some1: Option<String>,
  some2: Option<String>,
  some3: Option<String>,
  some4: Option<String>,
  some5: Option<String>,
  some6: Option<String>,
  some7: Option<String>,
  some8: Option<String>,
}

let tmp = someFn(someParams {some1: "smth",  some5: "smth", ..Default::default()})

However this also does not work as the someParams struct generated by OpenAPI does not derive from std::Default yet either.

Additional context

bon function examples
bon struct examples
bon method examples
std::Default
default example1
default example2

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

Start in the Rust generator and its templates or configuration for useBonBuilder; search for the generated bon version and inspect how dependency versions are tested. Update the pin or version selection, then run the Rust generator tests or a sample generation to verify that useBonBuilder produces the current intended bon dependency.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.