springdoc / springdoc-openapi-maven-plugin

Library for OpenAPI 3 with spring-boot
https://springdoc.org
Apache License 2.0
141 stars 37 forks source link

setBasePath in generated ApiClient sets OAuth2 path as well #38

Closed SeverityOne closed 2 years ago

SeverityOne commented 2 years ago

My apologies if this is in the wrong place; it's not immediately clear where the code generator resides.

When Maven generates client code, including the ApiClient class, there is the following method:

  /**
   * Sets the base URL to the location where the OpenAPI document is being served.
   *
   * @param basePath The base URL to the target host.
   * @return a {@link org.openapitools.client.ApiClient} object.
   */
  public ApiClient setBasePath(String basePath) {
    this.basePath = basePath;
    setOauthBasePath(basePath);
    return this;
  }

What isn't clear is why setOauthBasePath(basePath) is invoked. The OAuth2 server resides on a different endpoint from the REST service. The REST service doesn't expose an authentication/authorisation endpoint either.

Is this a bug, or is it expected behaviour?

bnasslahsen commented 2 years ago

As you mentioned, this the wrong place to ask. Search for openapitools repo instead.