openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

[REQ] rust: group operations into structs

Open maxnachlinger opened this issue 1 year ago • 0 comments

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

Group operations into meaningful chunks via Rust structs.

Describe the solution you'd like

given a file named: some_api.rs

and operation fn defined as:

pub fn some_operation0(configuration: &configuration::Configuration,) -> Result<models::SomeData0, Error<SomeError>> ...
pub fn some_operation1(configuration: &configuration::Configuration,) -> Result<models::SomeData1, Error<SomeError>> ...

group operations togetrher in a SomeApi struct:

pub struct SomeApi;

impl SomeApi {
  pub fn some_operation0(configuration: &configuration::Configuration,) -> Result<models::SomeData0, Error<SomeError>> ...
  pub fn some_operation1(configuration: &configuration::Configuration,) -> Result<models::SomeData1, Error<SomeError>> ...
}

Describe alternatives you've considered

Leaving the generator as is.

Additional context

maxnachlinger avatar May 11 '24 01:05 maxnachlinger