diff --git a/fern/products/sdks/generators/java/configuration.mdx b/fern/products/sdks/generators/java/configuration.mdx index 7def35218..89ca9ba30 100644 --- a/fern/products/sdks/generators/java/configuration.mdx +++ b/fern/products/sdks/generators/java/configuration.mdx @@ -102,7 +102,7 @@ Controls how the offset parameter is interpreted for [auto-paginated](/learn/sdk -When enabled, the generated SDK omits the `X-Fern-Language`, `X-Fern-SDK-Name`, and `X-Fern-SDK-Version` headers from HTTP requests. +When enabled, the generated SDK omits the `X-Fern-Language`, `X-Fern-SDK-Name`, `X-Fern-SDK-Version`, and `User-Agent` headers from HTTP requests. @@ -126,6 +126,29 @@ Publish target for Maven packages. Use `central` for Maven Central Portal or `os When enabled, generates `java.time.LocalDate` instead of `String` for Fern date types. This provides better type safety and enables compile-time validation for date values, while maintaining the same string wire format for API communication. + +Sets a custom `User-Agent` header template for requests sent by the generated SDK. The template is resolved at generation time and supports the following placeholders: + +* `{packageName}`: The published package name. +* `{version}`: The SDK version. +* `{language}`: The generation language (for example, `java`). +* `{generatorVersion}`: The Fern generator version. +* `{organization}`: The organization name from `fern.config.json`. +* `{apiName}`: The API name from your API definition. + +```yaml title="generators.yml" +groups: + java-sdk: + generators: + - name: fern-java-sdk + version: + config: + user-agent: "{organization}-plantstore/{version} ({language})" +``` + +With this configuration, the generated SDK sends a header such as `User-Agent: plantstore-api/0.1.0 (java)`. + + 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