From fb98c3e63e6d7ebb7b5604192ff1247b9e2a19ff Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 31 Jul 2026 17:09:17 +0000 Subject: [PATCH 1/2] docs: document user-agent template behavior with platform headers Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../sdks/generators/csharp/configuration.mdx | 13 ++++++++++++- .../products/sdks/generators/java/configuration.mdx | 4 +++- .../sdks/generators/python/configuration.mdx | 13 ++++++++++++- .../sdks/generators/typescript/configuration.mdx | 13 ++++++++++++- 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/fern/products/sdks/generators/csharp/configuration.mdx b/fern/products/sdks/generators/csharp/configuration.mdx index b440858a6d..0ef64bbded 100644 --- a/fern/products/sdks/generators/csharp/configuration.mdx +++ b/fern/products/sdks/generators/csharp/configuration.mdx @@ -96,7 +96,7 @@ When enabled, the generated SDK omits the `X-Fern-Language`, `X-Fern-SDK-Name`, -When enabled, the generated SDK sends a single structured `User-Agent` header of the form `{sdkName}/{version} ({os}; {arch}) {runtime}/{runtimeVersion}` (for example, `my-sdk/1.2.0 (linux; x86_64) dotnet/8.0.4`), carrying SDK, operating system, architecture, and runtime information in place of the default `User-Agent` and discrete platform headers. If `omit-fern-headers` is enabled, no `User-Agent` or platform headers are sent and this option has no effect. +When enabled, the generated SDK sends a single structured `User-Agent` header of the form `{sdkName}/{version} ({os}; {arch}) {runtime}/{runtimeVersion}` (for example, `my-sdk/1.2.0 (linux; x86_64) dotnet/8.0.4`), carrying SDK, operating system, architecture, and runtime information in place of the default `User-Agent` and discrete platform headers. A configured [`user-agent`](#user-agent) template supplies the leading product token. If `omit-fern-headers` is enabled, no `User-Agent` or platform headers are sent and this option has no effect. @@ -122,3 +122,14 @@ When enabled, places core SDK classes (like base client classes and utilities) i When enabled, generates discriminated union types for API responses that can contain multiple different object types. This provides type-safe handling of polymorphic responses. + + +Sets a custom `User-Agent` header template for requests sent by the generated SDK. The template is resolved at generation time and supports the `{packageName}`, `{version}`, `{language}`, `{generatorVersion}`, `{organization}`, and `{apiName}` placeholders. + +```yaml title="generators.yml" +config: + user-agent: "plantstore-dotnet-sdk/{version}" +``` + +This configuration sends `User-Agent: plantstore-dotnet-sdk/0.1.0`. With [`include-platform-headers`](#include-platform-headers) enabled, the resolved template becomes the product token of the structured header, followed by the platform and runtime segments: `User-Agent: plantstore-dotnet-sdk/0.1.0 (linux; x86_64) dotnet/8.0.4`. A resolved value whose trailing segment isn't a version, such as `plantstore/sdk-dotnet`, is used as-is and no version segment is added. + diff --git a/fern/products/sdks/generators/java/configuration.mdx b/fern/products/sdks/generators/java/configuration.mdx index 73473277d1..2347e06d14 100644 --- a/fern/products/sdks/generators/java/configuration.mdx +++ b/fern/products/sdks/generators/java/configuration.mdx @@ -110,7 +110,7 @@ When enabled, the generated SDK omits the `X-Fern-Language`, `X-Fern-SDK-Name`, -When enabled, the generated SDK sends a single structured `User-Agent` header of the form `{sdkName}/{version} ({os}; {arch}) {runtime}/{runtimeVersion}` (for example, `com.fern.sdk/0.0.1 (linux; x86_64) Java/17.0.13`), carrying SDK, operating system, architecture, and runtime information in place of the default `User-Agent` and discrete platform headers. If `omit-fern-headers` is enabled, no `User-Agent` or platform headers are sent and this option has no effect. +When enabled, the generated SDK sends a single structured `User-Agent` header of the form `{sdkName}/{version} ({os}; {arch}) {runtime}/{runtimeVersion}` (for example, `com.fern.sdk/0.0.1 (linux; x86_64) Java/17.0.13`), carrying SDK, operating system, architecture, and runtime information in place of the default `User-Agent` and discrete platform headers. A configured [`user-agent`](#user-agent) template supplies the leading product token. If `omit-fern-headers` is enabled, no `User-Agent` or platform headers are sent and this option has no effect. @@ -159,6 +159,8 @@ groups: ``` With this configuration, an organization named `plantstore` with an API named `plants` generates an SDK that sends `User-Agent: plantstore-plants/0.1.0 (java)`. + +With [`includePlatformHeaders`](#includeplatformheaders) enabled, the resolved template becomes the product token of the structured header, followed by the platform and runtime segments: a template of `plantstore-plants/{version}` sends `User-Agent: plantstore-plants/0.1.0 (linux; x86_64) Java/17.0.13`. A resolved value whose trailing segment isn't a version, such as `plantstore/sdk-java`, is used as-is and no version segment is added. diff --git a/fern/products/sdks/generators/python/configuration.mdx b/fern/products/sdks/generators/python/configuration.mdx index 14d45d14c9..ecac3fa47b 100644 --- a/fern/products/sdks/generators/python/configuration.mdx +++ b/fern/products/sdks/generators/python/configuration.mdx @@ -181,7 +181,7 @@ When enabled, the generated SDK omits the `X-Fern-Language`, `X-Fern-SDK-Name`, -When enabled, the generated SDK sends a single structured `User-Agent` header of the form `{sdkName}/{version} ({os}; {arch}) {runtime}/{runtimeVersion}` (for example, `fern_examples/0.0.1 (linux; x86_64) Python/3.11.0`), carrying SDK, operating system, architecture, and runtime information in place of the default `User-Agent` and discrete platform headers. If `omit_fern_headers` is enabled, no `User-Agent` or platform headers are sent and this option has no effect. +When enabled, the generated SDK sends a single structured `User-Agent` header of the form `{sdkName}/{version} ({os}; {arch}) {runtime}/{runtimeVersion}` (for example, `fern_examples/0.0.1 (linux; x86_64) Python/3.11.0`), carrying SDK, operating system, architecture, and runtime information in place of the default `User-Agent` and discrete platform headers. A configured [`user-agent`](#user-agent) template supplies the leading product token. If `omit_fern_headers` is enabled, no `User-Agent` or platform headers are sent and this option has no effect. @@ -219,6 +219,17 @@ When enabled, skips code formatting (like black) on the generated Python code. Sets the client timeout in seconds, or `infinity` to disable timeouts. + +Sets a custom `User-Agent` header template for requests sent by the generated SDK. Unlike the other Python options, this key is hyphenated. The template is resolved at generation time and supports the `{packageName}`, `{version}`, `{language}`, `{generatorVersion}`, `{organization}`, and `{apiName}` placeholders. + +```yaml title="generators.yml" +config: + user-agent: "plantstore-python-sdk/{version}" +``` + +This configuration sends `User-Agent: plantstore-python-sdk/0.1.0`. With [`include_platform_headers`](#include_platform_headers) enabled, the resolved template becomes the product token of the structured header, followed by the platform and runtime segments: `User-Agent: plantstore-python-sdk/0.1.0 (linux; x86_64) Python/3.11.0`. A resolved value whose trailing segment isn't a version, such as `plantstore/sdk-python`, is used as-is and no version segment is added. + + When enabled, includes the API name as part of the package structure and naming. diff --git a/fern/products/sdks/generators/typescript/configuration.mdx b/fern/products/sdks/generators/typescript/configuration.mdx index f9694f6160..ff994d217c 100644 --- a/fern/products/sdks/generators/typescript/configuration.mdx +++ b/fern/products/sdks/generators/typescript/configuration.mdx @@ -406,7 +406,7 @@ When enabled, the generated SDK omits the `X-Fern-Language`, `X-Fern-SDK-Name`, -When enabled, the generated SDK sends a single structured `User-Agent` header of the form `{sdkName}/{version} ({os}; {arch}) {runtime}/{runtimeVersion}` (for example, `my-sdk/0.0.1 (linux; x86_64) Node/20.11.0`), carrying SDK, operating system, architecture, and runtime information in place of the default `User-Agent` and discrete platform headers. If `omitFernHeaders` is enabled, no `User-Agent` or platform headers are sent and this option has no effect. +When enabled, the generated SDK sends a single structured `User-Agent` header of the form `{sdkName}/{version} ({os}; {arch}) {runtime}/{runtimeVersion}` (for example, `my-sdk/0.0.1 (linux; x86_64) Node/20.11.0`), carrying SDK, operating system, architecture, and runtime information in place of the default `User-Agent` and discrete platform headers. A configured [`user-agent`](#user-agent) template supplies the leading product token. If `omitFernHeaders` is enabled, no `User-Agent` or platform headers are sent and this option has no effect. @@ -526,6 +526,17 @@ The default is `web`. When `treatUnknownAsAny` is enabled, [unknown types from Fern are generated into TypeScript using `any` instead of the `unknown` type](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-0.html#new-unknown-top-type). + +Sets a custom `User-Agent` header template for requests sent by the generated SDK. Unlike the other TypeScript options, this key is hyphenated. The template is resolved at generation time and supports the `{packageName}`, `{version}`, `{language}`, `{generatorVersion}`, `{organization}`, and `{apiName}` placeholders. + +```yaml title="generators.yml" +config: + user-agent: "plantstore-node-sdk/{version}" +``` + +This configuration sends `User-Agent: plantstore-node-sdk/0.1.0`. With [`includePlatformHeaders`](#includeplatformheaders) enabled, the resolved template becomes the product token of the structured header, followed by the platform and runtime segments: `User-Agent: plantstore-node-sdk/0.1.0 (linux; x86_64) Node/20.11.0`. A resolved value whose trailing segment isn't a version, such as `@plantstore/sdk`, is used as-is and no version segment is added. + + When `useBigInt` is set to `true`, a customized JSON serializer & deserializer is used that will preserve the precision of `bigint`'s, as opposed to the native `JSON.stringify` and `JSON.parse` function which converts `bigint`'s to number's losing precision. From 7c1847c34d3b8b1ffc8de09ce8950cd5aee416a3 Mon Sep 17 00:00:00 2001 From: "devin.logan" Date: Mon, 3 Aug 2026 14:57:27 +0000 Subject: [PATCH 2/2] docs: document user-agent for Go, PHP, and Ruby and in the generators.yml reference Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- fern/products/sdks/generators/go/configuration.mdx | 13 ++++++++++++- fern/products/sdks/generators/php/configuration.mdx | 13 ++++++++++++- .../products/sdks/generators/ruby/configuration.mdx | 13 ++++++++++++- .../sdks/reference/generators-yml-reference.mdx | 2 ++ 4 files changed, 38 insertions(+), 3 deletions(-) diff --git a/fern/products/sdks/generators/go/configuration.mdx b/fern/products/sdks/generators/go/configuration.mdx index e480de85fa..932709a0ce 100644 --- a/fern/products/sdks/generators/go/configuration.mdx +++ b/fern/products/sdks/generators/go/configuration.mdx @@ -55,7 +55,7 @@ When enabled, the generated SDK omits the `X-Fern-Language`, `X-Fern-SDK-Name`, -When enabled, the generated SDK sends a single structured `User-Agent` header of the form `{sdkName}/{version} ({os}; {arch}) {runtime}/{runtimeVersion}` (for example, `my-sdk/0.0.1 (linux; x86_64) Go/1.22.0`), carrying SDK, operating system, architecture, and runtime information in place of the default `User-Agent` and discrete platform headers. If `omitFernHeaders` is enabled, no `User-Agent` or platform headers are sent and this option has no effect. +When enabled, the generated SDK sends a single structured `User-Agent` header of the form `{sdkName}/{version} ({os}; {arch}) {runtime}/{runtimeVersion}` (for example, `my-sdk/0.0.1 (linux; x86_64) Go/1.22.0`), carrying SDK, operating system, architecture, and runtime information in place of the default `User-Agent` and discrete platform headers. A configured [`user-agent`](#user-agent) template supplies the leading product token. If `omitFernHeaders` is enabled, no `User-Agent` or platform headers are sent and this option has no effect. @@ -172,4 +172,15 @@ Controls the union type generation strategy. Use 'v0' for the legacy union imple When enabled, uses `io.Reader` interface for handling byte request bodies instead of byte slices. This is more memory-efficient for large payloads and follows Go best practices for streaming data. + + + +Sets a custom `User-Agent` header template for requests sent by the generated SDK. Unlike the other Go options, this key is hyphenated. The template is resolved at generation time and supports the `{packageName}`, `{version}`, `{language}`, `{generatorVersion}`, `{organization}`, and `{apiName}` placeholders. + +```yaml title="generators.yml" +config: + user-agent: "plantstore-go-sdk/{version}" +``` + +This configuration sends `User-Agent: plantstore-go-sdk/0.1.0`. With [`includePlatformHeaders`](#includeplatformheaders) enabled, the resolved template becomes the product token of the structured header, followed by the platform and runtime segments: `User-Agent: plantstore-go-sdk/0.1.0 (linux; x86_64) Go/1.22.0`. A resolved value whose trailing segment isn't a version, such as `plantstore/sdk-go`, is used as-is and no version segment is added. \ No newline at end of file diff --git a/fern/products/sdks/generators/php/configuration.mdx b/fern/products/sdks/generators/php/configuration.mdx index b330555d07..ef0fca9d05 100644 --- a/fern/products/sdks/generators/php/configuration.mdx +++ b/fern/products/sdks/generators/php/configuration.mdx @@ -58,7 +58,7 @@ When enabled, the generated SDK omits the `X-Fern-Language`, `X-Fern-SDK-Name`, -When enabled, the generated SDK sends a single structured `User-Agent` header of the form `{sdkName}/{version} ({os}; {arch}) {runtime}/{runtimeVersion}` (for example, `my-sdk/0.0.1 (linux; x86_64) PHP/8.2.0`), carrying SDK, operating system, architecture, and runtime information in place of the default `User-Agent` and discrete platform headers. If `omitFernHeaders` is enabled, no `User-Agent` or platform headers are sent and this option has no effect. +When enabled, the generated SDK sends a single structured `User-Agent` header of the form `{sdkName}/{version} ({os}; {arch}) {runtime}/{runtimeVersion}` (for example, `my-sdk/0.0.1 (linux; x86_64) PHP/8.2.0`), carrying SDK, operating system, architecture, and runtime information in place of the default `User-Agent` and discrete platform headers. A configured [`user-agent`](#user-agent) template supplies the leading product token. If `omitFernHeaders` is enabled, no `User-Agent` or platform headers are sent and this option has no effect. @@ -72,3 +72,14 @@ Specifies the directory path where the generated SDK source files should be plac Controls the access level of generated class properties. When set to 'public', properties are public and getter/setter methods are omitted. When set to 'private', properties are private and getter/setter methods are generated for encapsulation. + + +Sets a custom `User-Agent` header template for requests sent by the generated SDK. Unlike the other PHP options, this key is hyphenated. The template is resolved at generation time and supports the `{packageName}`, `{version}`, `{language}`, `{generatorVersion}`, `{organization}`, and `{apiName}` placeholders. + +```yaml title="generators.yml" +config: + user-agent: "plantstore-php-sdk/{version}" +``` + +This configuration sends `User-Agent: plantstore-php-sdk/0.1.0`. With [`includePlatformHeaders`](#includeplatformheaders) enabled, the resolved template becomes the product token of the structured header, followed by the platform and runtime segments: `User-Agent: plantstore-php-sdk/0.1.0 (linux; x86_64) PHP/8.2.0`. A resolved value whose trailing segment isn't a version, such as `plantstore/sdk-php`, is used as-is and no version segment is added. + diff --git a/fern/products/sdks/generators/ruby/configuration.mdx b/fern/products/sdks/generators/ruby/configuration.mdx index 5367712ed8..32518c1911 100644 --- a/fern/products/sdks/generators/ruby/configuration.mdx +++ b/fern/products/sdks/generators/ruby/configuration.mdx @@ -101,7 +101,7 @@ When enabled, the generated SDK omits the `X-Fern-Language`, `X-Fern-SDK-Name`, -When enabled, the generated SDK sends a single structured `User-Agent` header of the form `{sdkName}/{version} ({os}; {arch}) {runtime}/{runtimeVersion}` (for example, `my-sdk/0.0.1 (linux; x86_64) Ruby/3.2.0`), carrying SDK, operating system, architecture, and runtime information in place of the default `User-Agent` and discrete platform headers. If `omitFernHeaders` is enabled, no `User-Agent` or platform headers are sent and this option has no effect. +When enabled, the generated SDK sends a single structured `User-Agent` header of the form `{sdkName}/{version} ({os}; {arch}) {runtime}/{runtimeVersion}` (for example, `my-sdk/0.0.1 (linux; x86_64) Ruby/3.2.0`), carrying SDK, operating system, architecture, and runtime information in place of the default `User-Agent` and discrete platform headers. A configured [`user-agent`](#user-agent) template supplies the leading product token. If `omitFernHeaders` is enabled, no `User-Agent` or platform headers are sent and this option has no effect. @@ -118,3 +118,14 @@ config: This will load `lib//custom_integration.rb` and `lib//sentry_integration.rb` when the gem is required. + + +Sets a custom `User-Agent` header template for requests sent by the generated SDK. Unlike the other Ruby options, this key is hyphenated. The template is resolved at generation time and supports the `{packageName}`, `{version}`, `{language}`, `{generatorVersion}`, `{organization}`, and `{apiName}` placeholders. + +```yaml title="generators.yml" +config: + user-agent: "plantstore-ruby-sdk/{version}" +``` + +This configuration sends `User-Agent: plantstore-ruby-sdk/0.1.0`. With [`includePlatformHeaders`](#includeplatformheaders) enabled, the resolved template becomes the product token of the structured header, followed by the platform and runtime segments: `User-Agent: plantstore-ruby-sdk/0.1.0 (linux; x86_64) Ruby/3.2.0`. A resolved value whose trailing segment isn't a version, such as `plantstore/sdk-ruby`, is used as-is and no version segment is added. + diff --git a/fern/products/sdks/reference/generators-yml-reference.mdx b/fern/products/sdks/reference/generators-yml-reference.mdx index 1fa9ebdb25..af8c55b742 100644 --- a/fern/products/sdks/reference/generators-yml-reference.mdx +++ b/fern/products/sdks/reference/generators-yml-reference.mdx @@ -663,6 +663,8 @@ groups: noSerdeLayer: false ``` +Most keys are specific to one generator, but `user-agent` is resolved by the CLI, so it behaves identically in every generator's `config`: it sets a [`User-Agent` header template](/learn/sdks/generators/typescript/configuration#user-agent) interpolated at generation time, defaulting to `{packageName}/{version}`. The TypeScript, Python, Go, Java, .NET, PHP, and Ruby generators send the resolved value; the Rust and Swift generators ignore it. + } href="/sdks/generators/typescript/configuration">