Skip to Content

Java Configuration Options

This section details the available configuration options for the Java SDK. All configuration is managed in the gen.yaml file under the java section.

Version and general configuration

java: version: 1.2.3 projectName: "openapi" description: "A description of your SDK"
Name
version
Required
true
Description
The current version of the SDK.
Default Value
0.0.1
projectName
Required
true
Description
Assigns Gradle
, which names the Gradle build. See Gradle Naming .
Default Value
openapi
description
Required
false
Description
A description of the SDK that will be included in the generated Gradle build file.
Default Value
SDK enabling Java developers to easily integrate with the {CompanyName} API.

Publishing

java: groupID: "com.mycompany" artifactID: "my-sdk" githubURL: "https://github.com/mycompany/my-sdk" companyName: "My Company" companyURL: "https://www.mycompany.com" companyEmail: "support@mycompany.com"
Name
groupID
Required
true
Description
The group ID used for namespacing the package. Typically the reversed domain of an organization.
Default Value
org.openapis
artifactID
Required
true
Description
The artifact ID used for namespacing the package, usually the name of the project.
Default Value
openapi
githubURL
Required
for publishing
Description
The GitHub URL where the artifact is hosted. Sets metadata required by Maven.
Default Value
github.com/owner/repo
companyName
Required
for publishing
Description
The name of your company. Sets metadata required by Maven.
Default Value
My Company
companyURL
Required
for publishing
Description
Your company's homepage URL. Sets metadata required by Maven.
companyEmail
Required
for publishing
Description
A support email address for your company. Sets metadata required by Maven.
Default Value

Base package name

This package will be where the primary SDK class is located (and sub-packages will hold various types of associated generated classes):

java: packageName: com.mycompany.sdk

Additional Dependencies

java: additionalDependencies: - "implementation:com.fasterxml.jackson.core:jackson-databind:2.12.3" - "testImplementation:junit:junit:4.13.2"
Name
additionalDependencies
Required
false
Description
Adds additional dependencies to include in
. Format:
.
Default Value
[]
additionalPlugins
Required
false
Description
Adds additional plugins to include in
. Format:
.
Default Value
[]

License

java: license: name: "The MIT License (MIT)" url: "https://mit-license.org/" shortName: "MIT"
Name
license
Required
false
Description
License information. Defaults to the MIT license if not provided.
Default Value
MIT License

Method and parameter management

java: maxMethodParams: 4
Name
Required
false
Description
Maximum number of parameters before an input object is created.
means input objects are always used.
Default Value
4

Security configuration

java: flattenGlobalSecurity: true
Property
Description
Enables inline security credentials during SDK instantiation. Recommended:
Default
true
Type
boolean

Import management

java: imports: paths: callbacks: models/callbacks errors: models/errors operations: models/operations shared: models/components webhooks: models/webhooks
Field
paths
Required
false
Description
Customizes where different parts of the SDK (e.g., callbacks, errors, and operations) will be imported from.
Default Value
{}

Import paths

Component
callbacks
Default Value
models/callbacks
Description
The directory where callback models will be imported from.
errors
Default Value
models/errors
Description
The directory where error models will be imported from.
operations
Default Value
models/operations
Description
The directory where operation models (i.e., API endpoints) will be imported from.
shared
Default Value
models/components
Description
The directory for shared components, such as reusable schemas and data models, imported from the OpenAPI spec.
webhooks
Default Value
models/webhooks
Description
The directory for webhook models, if your SDK includes support for webhooks.

Error and response handling

java: clientServerStatusCodesAsErrors: false
Name
clientServerStatusCodesAsErrors
Required
false
Description
Whether to treat 4xx and 5xx status codes as errors. Options:
or
.
Default Value
true

Last updated on