OpenAPITools / OpenAPITools/openapi-generator

[REQ] store and expose via `getApiClient()` the `ApiClient` used to create a library:native Api object

Open
#20,922 0 comments 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.

most (the base + httpclient, google-api, jersey2/3, okhttp, etc) Api objects expose the ApiClient used to create them via a public ApiClient getApiClient() method. library:native does not which makes it impossible to create additional Api objects from an Api object without using the Configuration.getDefaultApiClient() singleton (which may or may not be what was used to create a particular Api object).

Describe the solution you'd like

add a public ApiClient getApiClient() method to library:native's api.mustache.

Describe alternatives you've considered

passing the ApiClient around and forcing methods to create their own Api wrappers or defaulting to the global singleton Configuration.defaultApiClient.

Additional context

happy to implement this myself. PR forthcoming.

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

Read the library:native api.mustache template and compare how other libraries expose their ApiClient. Add the requested public accessor there, then verify that generated native Api objects expose the client used to create them.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Feature
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.