Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions fern/products/api-def/openapi/extensions/pagination.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

<CodeBlocks>
```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
Expand Down
3 changes: 3 additions & 0 deletions fern/products/home/pages/fern-instructions/sdks/migrate.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
24 changes: 10 additions & 14 deletions fern/products/sdks/deep-dives/testing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading