Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion : Creating the global variable WebTarget target #12353

Open
Clement44Ges opened this issue Mar 8, 2024 · 0 comments
Open

Suggestion : Creating the global variable WebTarget target #12353

Clement44Ges opened this issue Mar 8, 2024 · 0 comments

Comments

@Clement44Ges
Copy link

Description

Suggestion : In the generated ApiClient class, all attributes are not defined as global variables. I'm thinking of the local variable "WebTarget target" in the invokeAPI method.
To address observability problems it would be interesting to be able to recover it after treatment.

language : java (17)
library : jersey3

Swagger-codegen version

Check with maven

    <groupId>io.swagger.codegen.v3</groupId>
    <artifactId>swagger-codegen-maven-plugin</artifactId>
    <version>3.0.52</version>
Swagger declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggestion

Creating the global variable

    protected WebTarget target;
    
    public ApiClient() {

Declare the getter

    public WebTarget getWebTarget(){
        return this.target;
    }

Use variable global in the method invokeAPI

    public <T> T invokeAPI(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType) throws ApiException {
        updateParamsForAuth(authNames, queryParams, headerParams);

        // Use variable global
        this.target = httpClient.target(this.basePath + path);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant