Java Configuration

You can customize the behavior of the Java SDK generator in generators.yml:

1default-group: local
2groups:
3 local:
4 generators:
5 - name: fernapi/fern-java-sdk
6 version: 2.39.0
7 config:
8 client-class-name: YourApiClient

SDK Configuration Options

base-api-exception-class-name
string
base-exception-class-name
string
client-class-name
stringDefaults to <Organization>ApiClient

The provided string will be used as the client class name.

custom-dependencies
List<string>

Example:

1custom-dependencies:
2- "implementation com.foo:bar:0.0.0"
3- "testImplementation com.foo:bar:0.0.0"
4- "api com.foo:bar:0.0.0"
disable-required-property-builder-checks
booleanDefaults to false
enable-forward-compatible-enums
booleanDefaults to false
enable-inline-types
booleanDefaults to false
enable-public-constructors
booleanDefaults to false

When enabled, generates public constructors for model types.

generate-unknown-as-json-node
booleanDefaults to false
inline-file-properties
booleanDefaults to false
inline-path-parameters
booleanDefaults to false
json-include
'non-empty' | 'non-absent'Defaults to non-absent
package-layout
'nested' | 'flat'Defaults to nested
package-prefix
string

By default, the generated SDK will use the package prefix com.{orgName}.api, where {orgName} is your Fern organization name (defined in fern.config.json). To override this, you can specify the package-prefix field in your generators.yml configuration.

config:
package-prefix: my.new.package
publish-to
'central' | 'ossrh'
wrapped-aliases
booleanDefaults to false

When enabled, generates wrapper types for each alias to increase type-safety. For example, if you have an alias ResourceId: string then if this is true, the generator will generate a ResourceId.java file. If false, it will just treat it as java.util.String.

Publishing metadata configuration options

If you want to customize how your publishing metadata looks in your build.gradle file, update the metadata field in generators.yml.

1 generators:
2 - name: fernapi/fern-java-sdk
3 version: 2.7.0
4 metadata:
5 author: "AuthorName"
6 email: "example@email.com"
7 package-description: "Your site description here"
8 reference-url: "https://example.com"
9 license: "MIT"
author
string
email
string
license
'MIT' | 'Apache-2.0' | { custom: 'Custom License Name' }
package-description
string
reference-url
string