Java Libraries Architecture ‐ feign - ronreynolds/openapi-generator GitHub Wiki

(as of 2025-02-26)

invoker-package

ApiClient

  • fields
    • -log: java.util.logging.Logger (final)
    • if jackson
      • #objectMapper: ObjectMapper
    • -basePath: String
    • -apiAuthorizations: Map< String, RequestInterceptor>
    • -feignBuilder: Feign.Builder
  • methods
    • +ApiClient()
    • +ApiClient(authNames: String[])
    • +ApiClient(authName: String)
    • +ApiClient(authName: String, apiKey: String)
    • +getBasePath(): String
    • +setBasePath(String): ApiClient
    • +getApiAuthorizations(): Map< String, RequestInterceptor>
    • +setApiAuthorizations(Map< String, RequestInterceptor>): void
    • +getFeignBuilder(): Feign.Builder
    • +setFeignBuilder(Feign.Builder): ApiClient
    • if jackson
      • -createObjectMapper(): ObjectMapper
      • +getObjectMapper(): ObjectMapper
      • +setObjectMapper(ObjectMapper): ApiClient
    • if hasOAuthMethods
      • -buildOauthRequestInterceptor(OAuthFlow, String, String, String): RequestInterceptor
      • +setClientCredentials(String, String): void
      • +setOauthPassword(String, String, String, String): void
      • +setAccessToken(String, Integer): void
      • +configureAuthorizationFlow(String, String, String): void
      • +registerAccessTokenListener(AccessTokenListener): void
    • +buildClient(Class< T>) : T extends Api
    • +selectHeaderAccept(String[]): String
    • +selectHeaderContentType(String[]): String
    • +setBearerToken(String): void
    • +setBearerToken(Supplier< String>): void
    • +setApiKey(String): void
    • +setCredentials(String, String): void
    • +getAuthorization(String): RequestInterceptor
    • +addAuthorization(String, RequestInterceptor): void
    • -getAuthorization(Class< T>): T extends RequestInterceptor

ApiClient.Api (interface)

  • fields
    • none
  • methods
    • none?

ApiResponseDecoder extends feign.jackson.JacksonDecoder

  • fields
    • none
  • methods
    • +ApiResponseDecoder(ObjectMapper)
    • +decode(Response, Type): Object

EncodingUtils ("Utilities to support Swagger encoding formats in Feign")

  • fields
    • none
  • methods
    • -EncodingUtils()
    • +encodeCollection(Collection< ?>, String): Object (VERY similar to ApiClient.parameterToPairs() et al)
    • +encode(Object): String (VERY similar to ApiClient.escapeString() et al)

ParamExpander implements feign.Param.Expander

  • fields
    • -dateFormat: DateFormat = new RFC3339DateFormat (final)
  • methods
    • +expand(Object): String (VERY similar to native/ApiClient.valueToString())

RFC3339DateFormat extends DateFormat (common)

  • fields
    • -serialVersionUID: long = 1 (final) (because ancestor class is Serializable)
    • -TIMEZONE_Z: TimeZone = TimeZone.getTimeZone("UTC") (final)
    • -fmt: StdDateFormat (final)
  • methods
    • +RFC3339DateFormat()
    • +parse(String): Date
    • +parse(String, ParsePosition): Date
    • +format(Date, StringBuffer, FieldPosition): StringBuffer
    • +clone(): Object (because ancestor class is Cloneable)

ServerConfiguration (common)

  • fields (all public non-final!)
    • +URL: String
    • +description: String
    • +variables: Map< String, ServerVariable>
  • methods
    • +ServerConfiguration(String, String, Map< String, ServerVariable>)
    • +URL(Map< String,String>): String
    • +URL(): String

ServerVariable (common)

  • fields (all public non-final!)
    • +description: String
    • +defaultValue: String
    • +enumValues: HashSet< String> = null
  • methods
    • +ServerVariable(String, String, HashSet< String>)

StringUtil (common)

  • fields
    • none
  • methods
    • +containsIgnoreCase(String[], String): boolean
    • +join(String[], String): String
    • +join(Collection< String>, String): String

api-package

DomainApi (interface) extends ApiClient.Api

  • fields
    • none
  • methods
    • +operation(operation-input): Response-Type
    • +operationWithHttpInfo(operation-input): ApiResponse< Response-Type>

auth-package

ApiErrorDecoder implements feign.codec.ErrorDecoder (specific to 401/403 errors; ergo in auth package)

  • fields
    • -defaultErrorDecoder: ErrorDecoder.Default (final)
  • methods
    • +decode(String, Response): Exception

ApiKeyAuth implements feign.RequestInterceptor

  • fields
    • -location: String (final)
    • -paramName: String (final)
    • -apiKey: String
  • methods
    • +ApiKeyAuth(String, String)
    • +getLocation(): String
    • +getParamName(): String
    • +getApiKey(): String
    • +setApiKey(String): void
    • +apply(feign.RequestTemplate): void

DefaultApi20Impl extends com.github.scribejava.core.builder.api.DefaultApi20

  • fields
    • -accessTokenEndpoint: String (final)
    • -authorizationBaseUrl: String (final)
  • methods
    • #DefaultApi20Impl(String, String)
    • +getAccessTokenEndpoint(): String
    • +getAuthorizationBaseUrl(): String
    • +getBearerSignature(): BearerSignature
    • +getClientAuthentication(): ClientAuthentication
    • +getAccessTokenExtractor(): TokenExtractor< OAuth2AccessToken>

HttpBasicAuth implements feign.RequestInterceptor

  • fields
    • -username: String
    • -password: String
  • methods
    • +getUsername(): String
    • +setUsername(String): void
    • +getPassword(): String
    • +setPassword(String): void
    • +setCredentials(String, String): void
    • +apply(feign.RequestTemplate): void

HttpBearerAuth implements feign.RequestInterceptor (same issues as common HttpBearerAuth)

  • fields
    • -scheme: String (final) (e.g., "Bearer"; why does this even support different schemes? "Bearer" is in the class name)
    • -tokenSupplier: Supplier< String>
  • methods
    • -upperCaseBearer(String): String (called every time in apply; should be moved to ctor as in [https://github.com/OpenAPITools/openapi-generator/pull/20743])
    • +HttpBearerAuth(String scheme)
    • +getBearerToken(): String
    • +setBearerToken(String): void
    • +setBearerToken(Supplier< String>): void
    • +apply(feign.RequestTemplate): void (inefficient use of Optional as ternary; same as in common HttpBearerAuth)

OAuth implements feign.RequestInterceptor (abstract)

  • fields
    • LEEWAY_SECONDS: int = 10 (final)
    • MILLIS_PER_SECOND: int = 1000 (final)
    • -accessToken: String (volatile) (why specifically this ref?)
    • -expirationTimeSeconds: Long
    • -accessTokenListener: OAuth.AccessTokenListener
    • #service: OAuth20Service
    • #scopes: String
    • #authorizationUrl: String
    • #tokenUrl: String
  • methods
    • +OAuth(String, String, String)
    • +apply(feign.RequestTemplate): void
    • +registerAccessTokenListener(AccessTokenListener): void (synchronized) (no reason to synchronize if accessTokenLister was volatile)
    • +getAccessToken(): String (synchronized) (possibly synchronized to avoid check-then-act logic; specifically expirationTimeSeconds == null)
    • +setAccessToken(String, Integer): void (synchronized)
    • getOAuth2AccessToken(): OAuth2AccessToken (abstract)
    • getFlow(): OAuthFlow (abstract)
    • -requestContainsNonOauthAuthorization(feign.RequestTemplate): boolean
    • -updateAccessToken(): void (synchronized)

OAuth.AccessTokenListener (interface)

  • fields
    • none
  • methods
    • +notify(OAuth2AccessToken): void

OauthClientCredentialsGrant extends OAuth

  • fields
    • none (modifies OAuth.service)
  • methods
    • +OauthClientCredentialsGrant(String, String, String)
    • +configure(String, String): void
    • #getOAuth2AccessToken(): OAuth2AccessToken
    • #getFlow(): OAuthFlow = APPLICATION

OAuthFlow (enum) (common)

  • fields (all final)
    • ACCESS_CODE
    • IMPLICIT
    • PASSWORD
    • APPLICATION
  • methods
    • none

OauthPasswordGrant extends OAuth

  • fields
    • -username: String
    • -password: String
  • methods
    • +OauthPasswordGrant(String, String)
    • +configure(String, String, String, String): void
    • #getOAuth2AccessToken(): OAuth2AccessToken
    • #getFlow(): OAuthFlow = PASSWORD

model-package

ApiResponse< T> (not google-code-style)

  • fields
    • -statusCode: int (final)
    • -headers: Map< String, Collection< String>> (final)
    • -data: T
  • methods
    • +ApiResponse(int, Map< String, Collection< String>>, T)
    • +getStatus(): int
    • +getHeaders(): Map< String, Collection< String>>
    • +getData(): T

Model-Type

  • fields
    • -field-name: Field-Type
  • methods
    • +Model-Type()
    • +field-name(Field-Type): Model-Type (for fluent set chaining)
    • if Field-Type is collection
      • +addField-name(Field-Type): Model-Type (for fluent set chaining)
    • +getField-name(): Field-Type
    • +setField-name(Field-Type): void
    • +equals(Object): boolean
    • +hashCode(): int
    • +toString(): String
    • -toIndentedString(Object): String (could be a shared static utility method)
⚠️ **GitHub.com Fallback** ⚠️