Skip to content

How to update outdated Samples

Error Message:

Cannot sample for transaction "GET /api/v1/launches -> 200",
because it based on version "abc123" but the loaded samples
are based on version "def456".

Samples become outdated when you modify your OpenAPI specification:

  • Adding or removing endpoints
  • Changing request/response schemas
  • Modifying path parameters or query parameters
  • Updating response status codes

The sampler tracks the specification version and detects mismatches to ensure test reliability.

Before regenerating, understand what changed in your API.Review endpoints, schemas, and contracts that were modified.

Run the init command with the --overwrite flag:

Terminal window
thymian sampler init --overwrite

This will:

  • Generate new sample data based on the updated specification
  • Overwrite request.json files with new sample values
  • Update the version hash in meta.json
  • Regenerate TypeScript types in types.d.ts
  • Leaves hook files untouched

Check the regenerated samples to ensure they match your expectations and inspect critical request.json files to verify the generated data is appropriate.

If the auto-generated samples don’t fit your needs, customize them manually:

{
"body": {
"missionName": "Apollo 11",
"launchDate": "2026-07-20T20:17:00Z",
"rocketType": "Saturn V"
}
}

See How to Customize Request Data for details.

If your API changes affect authentication or data dependencies, update your hooks. Verify that hooks still work with the new API structure.

Verify everything works:

Terminal window
thymian sampler check

The version hash is calculated from:

  • All endpoint definitions (paths, methods, status codes)
  • Request and response schemas
  • Security requirements
  • Server URLs