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

(as of 2025-02-26)

invoker-package

ApiClient

  • fields
    • -builder: HttpClient.Builder
    • -mapper: ObjectMapper
    • -scheme: String
    • -host: String
    • -port: int
    • -basePath: String
    • -interceptor: Consumer< HttpRequest.Builder>
    • -responseInterceptor: Consumer< HttpResponse< InputStream>>
    • -asyncResponseInterceptor: Consumer< HttpResponse< String>>
    • -readTimeout: Duration
    • -connectTimeout: Duration
  • methods
    • +valueToString(Object): String (deprecate and move to String util class)
    • +urlEncode(String): String (deprecate and move to HTTP util class)
    • +parameterToPairs(String, Object): List< Pair> (deprecate and move to Pair class)
    • +parameterToPairs(String, String, Collection< ?>): List< Pair> (deprecate and move to Pair class)
    • +createDefaultObjectMapper(): ObjectMapper (deprecate and move to JSON class)
    • +createDefaultHttpClientBuilder(): HttpClient.Builder (could be in a HTTP util class instead)
    • +ApiClient()
    • +ApiClient(HttpClient.Builder, ObjectMapper, String)
    • -getDefaultBaseUri(): String
    • +updateBaseUri(String): void
    • +setHttpClientBuilder(HttpClient.Builder): ApiClient
    • +getHttpClient(): HttpClient
    • +setObjectMapper(ObjectMapper): ApiClient
    • +getObjectMapper(): ObjectMapper
    • +setHost(String host): ApiClient
    • +setPort(int port): ApiClient
    • +setBasePath(String): ApiClient
    • +getBaseUri(): String
    • +setScheme(String): ApiClient
    • +setRequestInterceptor(Consumer< HttpRequest.Builder>): ApiClient
    • +getRequestInterceptor(): Consumer< HttpRequest.Builder>
    • +setResponseInterceptor(Consumer< HttpResponse< InputStream>>): ApiClient
    • +getResponseInterceptor(): Consumer< HttpResponse< InputStream>>
    • +setAsyncResponseInterceptor(Consumer< HttpResponse< String>>): ApiClient
    • +getAsyncResponseInterceptor(): Consumer< HttpResponse< String>>
    • +setReadTimeout(Duration): ApiClient
    • +getReadTimeout(): Duration
    • +setConnectTimeout(Duration): ApiClient
    • +getConnectTimeout(): Duration

ApiException extends Exception (too many ctors; could use a builder)

  • fields
    • -serialVersionUID: long = 1 (ancestor is Serializable)
    • -code: int
    • -responseHeaders: HttpHeaders
    • -responseBody: String
  • methods
    • +ApiException()
    • +ApiException(Throwable)
    • +ApiException(String)
    • +ApiException(String, Throwable, int, HttpHeaders, String)
    • +ApiException(String, int, HttpHeaders, String)
    • +ApiException(String, Throwable, int, HttpHeaders)
    • +ApiException(int, HttpHeaders, String)
    • +ApiException(int, String)
    • +ApiException(int, String, HttpHeaders, String)
    • +getCode(): int
    • +getResponseHeaders(): HttpHeaders
    • +getResponseBody(): String

ApiResponse< T>

  • fields (could all be final)
    • -statusCode: int
    • -headers: Map< String, List< String>>
    • -data: T
  • methods
    • +ApiResponse(int, Map<String, List>)
    • +ApiResponse(int, Map<String, List>, T)
    • +getStatusCode(): int
    • +getHeaders(): Map< String, List< String>> (exposes mutable Map)
    • +getData(): T

Configuration pending enhancements

  • fields
    • +VERSION: String = "2.0.0" (final)
    • -defaultApiClient: ApiClient = new ApiClient
  • methods
    • +getDefaultApiClient(): ApiClient
    • +setDefaultApiClient(ApiClient): void

JSON

  • fields
    • -json: JSON = new JSON() (pseudo-singleton; non-final)
    • -modelDiscriminators: Map< Class< ?>, ClassDiscriminatorMapping>
    • -modelDescendants: Map< Class< ?>, Map<String, Class<?>>>
    • -mapper: ObjectMapper (could be final)
  • methods
    • +registerDiscriminator(Class< ?>, String, Map< String, Class< ?>>): void
    • +registerDescendants(Class< ?>, Map< String, Class< ?>> descendants): void
    • +getDefault(): JSON
    • +setDefault(JSON): void
    • +getClassForElement(JsonNode, Class< ?>): Class< ?>
    • +isInstanceOf(Class< ?>, Object, Set< Class< ?>>): boolean
    • +JSON()
    • +setDateFormat(DateFormat): void
    • +getMapper(): ObjectMapper

JSON.ClassDiscriminatorMapping (private static inner-class)

  • fields
    • modelClass: Class< ?>
    • discriminatorName: String
    • discriminatorMappings: Map< String, Class< ?>>
  • methods
    • ClassDiscriminatorMapping(Class< ?> cls, String propertyName, Map<String, Class< ?>> mappings)
    • getDiscriminatorPropertyName(): String
    • getDiscriminatorValue(JsonNode): String
    • getClassForElement(JsonNode, Set< Class< ?>>): Class< ?>

Pair (not in google-style)

  • fields
    • -name: String = "" (could be final; only ctor calls set)
    • -value: String = "" (could be final; only ctor calls set)
  • methods
    • +Pair(String, String)
    • +getName(): String
    • +getValue(): String
    • -setName(String): void
    • -setValue(String): void
    • -isValidString(String): boolean

RFC3339DateFormat extends DateFormat

  • 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 (not in google-style)

  • 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 (not in google-style)

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

api-package

DomainApi

  • fields
    • -memberVarHttpClient: HttpClient (final)
    • -memberVarObjectMapper: ObjectMapper (final)
    • -memberVarBaseUri: String (final)
    • -memberVarInterceptor: Consumer< HttpRequest.Builder> (final)
    • -memberVarReadTimeout: Duration (final)
    • -memberVarResponseInterceptor: Consumer< HttpResponse< InputStream>> (final)
    • -memberVarAsyncResponseInterceptor: Consumer< HttpResponse< String>> (final)
  • methods
    • DomainApi()
    • DomainApi(ApiClient)
      • extracts all field values from ApiClient
    • #getApiException(String, HttpResponse< InputStream>): ApiException (could be static if formatExceptionMessage is static)
    • #formatExceptionMessage(String, int, String): String (could be static)
    • +operation(operation-input): Response-Type
    • +operationWithHttpInfo(operation-input): ApiResponse< Response-Type>
    • -operationRequestBuilder(operation-input): HttpRequest.Builder

model-package

AbstractOpenApiSchema

  • fields
    • -instance: Object
    • -isNullable: Boolean
    • -schemaType: String (final)
  • methods
    • +AbstractOpenApiSchema(String, Boolean)
    • +getSchemas(): Map<String,Class<?>>
    • +getActualInstance(): Object
    • +setActualInstance(Object): void
    • +getActualInstanceRecursively(): Object
    • -getActualInstanceRecursively(AbstractOpenApiSchema): Object
    • +getSchemaType(): String
    • +toString(): String
    • -toIndentedString(Object): String
    • +equals(Object): boolean
    • +hashCode(): int
    • +isNullable(): Boolean (should return boolean)

Model-Type

  • fields
    • -field-name: Field-Type
  • methods
    • +Model-Type()
    • +field-nameget(): Field-Type
    • +field-nameset(Field-Type): void
    • +field-name(Field-Type): Type (for fluent set chaining)
    • +equals(Object): boolean
    • +hashCode(): int
    • +toString(): String
    • -toIndentedString(Object): String (could be static)
    • +toUrlQueryString(): String
    • +toUrlQueryString(prefix: String): String
      • uses ApiClient.valueToString
⚠️ **GitHub.com Fallback** ⚠️