diff --git a/fern/products/api-def/openapi/extensions/pagination.mdx b/fern/products/api-def/openapi/extensions/pagination.mdx index d49d26a0b..1dbfdd880 100644 --- a/fern/products/api-def/openapi/extensions/pagination.mdx +++ b/fern/products/api-def/openapi/extensions/pagination.mdx @@ -10,23 +10,28 @@ The `x-fern-pagination` extension configures auto-pagination for list endpoints To configure pagination: 1. Annotate the desired paginated endpoint with the `x-fern-pagination` extension -2. Specify the pagination scheme (`offset`, `cursor`, `next_uri`, or `next_path`) +2. Specify the pagination scheme (`offset`, `cursor`, `next_uri`, or `next_path`). For `offset`, also set `step` to the page-size request parameter. SDK Config generators skip auto-pagination for offset pagination without `step`, and for `next_uri` and `next_path`. 3. Specify where your `results` are located using dot-access notation -```yaml title="Offset pagination" {5-7} +```yaml title="Offset pagination" {5-8} paths: /plants: get: operationId: list_plants x-fern-pagination: offset: $request.page_number + step: $request.page_size results: $response.results parameters: - name: page_number in: query schema: type: integer + - name: page_size + in: query + schema: + type: integer responses: '200': description: List of plants diff --git a/fern/products/home/pages/fern-instructions/sdks/migrate.mdx b/fern/products/home/pages/fern-instructions/sdks/migrate.mdx index 14bd67286..ce356483d 100644 --- a/fern/products/home/pages/fern-instructions/sdks/migrate.mdx +++ b/fern/products/home/pages/fern-instructions/sdks/migrate.mdx @@ -23,6 +23,9 @@ Use this for config migrations and major generator or CLI upgrades. - Release major generator upgrades as a new major SDK version when the public API changes. - Keep `.fernignore` and Replay settings when moving config. +- Enable `generation.unitTests.enabled` or `generation.wireTests.enabled` in `sdk-config.yml`. SDK Config generators write no tests otherwise (C# excepted). +- Set `step` on every offset `x-fern-pagination`. SDK Config generators skip offset pagination without it. +- Keep a legacy bearer `token.name` with `x-fern-bearer: { name: ... }` on the OpenAPI security scheme. SDK Config bearer schemes have no name field. ## Reference diff --git a/fern/products/sdks/deep-dives/testing.mdx b/fern/products/sdks/deep-dives/testing.mdx index fb673e760..853ec3586 100644 --- a/fern/products/sdks/deep-dives/testing.mdx +++ b/fern/products/sdks/deep-dives/testing.mdx @@ -12,7 +12,15 @@ Fern auto-generates tests that must pass before SDK release. Fern generates a Gi ### Unit tests -Fern generates unit tests for all SDK languages. They verify individual methods in isolation without making network calls. +Fern generates unit tests for all SDK languages. They verify individual methods in isolation without making network calls. In `sdk-config.yml`, enable them with [`generation.unitTests.enabled`](/learn/sdks/reference/sdk-config#generation): + +```yaml title="sdk-config.yml" +generation: + unitTests: + enabled: true +``` + +SDK Config generators write no tests for a target unless `unitTests.enabled` or `wireTests.enabled` is `true`. C# is the only exception, and it generates tests when neither is set. Enabling either setting turns on both unit tests and mock server tests. ### Mock server tests @@ -28,19 +36,7 @@ generation: enabled: true ``` -When `wireTests.enabled` isn't set, the default depends on the language: - -| Language | Default | -|----------|---------| -| TypeScript | true | -| Python | false | -| Go | true | -| Java | false | -| .NET/C# | true | -| PHP | false | -| Swift | true | -| Rust | false | -| Ruby | false | +When neither `wireTests.enabled` nor `unitTests.enabled` is set, only C# SDKs get mock server tests. ## Integration tests diff --git a/fern/products/sdks/legacy/generators/migration-guides/sdk-config.mdx b/fern/products/sdks/legacy/generators/migration-guides/sdk-config.mdx index 71662fa00..f5b5b8771 100644 --- a/fern/products/sdks/legacy/generators/migration-guides/sdk-config.mdx +++ b/fern/products/sdks/legacy/generators/migration-guides/sdk-config.mdx @@ -179,6 +179,10 @@ Confirm that: - The API source paths, output, and publishing configuration are correct. - The credential environment variables that publishing needs are available. - Each API Reference that uses the migrated API lists its specs under `specs`. For an API with proto specs, the docs configuration is unchanged. +- Tests are enabled. Legacy generators always write unit tests, but SDK Config generators only write them when [`generation.unitTests.enabled`](/learn/sdks/reference/sdk-config#generation) or `generation.wireTests.enabled` is `true`. +- Every offset [`x-fern-pagination`](/learn/api-definitions/openapi/extensions/pagination) annotation sets `step`. SDK Config generators skip auto-pagination for offset pagination without it. +- Bearer token parameter names are kept. SDK Config bearer schemes have no parameter name, so a legacy `token.name` such as `access_token` becomes the generator default unless the OpenAPI security scheme sets [`x-fern-bearer`](/learn/api-definitions/openapi/authentication). +- Every warning `fern sdk migrate` printed is resolved or accepted. ### Choose a generator version