Skip to content

release: 0.8.x integration safety#67

Merged
romanindev merged 8 commits intomainfrom
feature/release-0-8-x-integration-safety
Apr 28, 2026
Merged

release: 0.8.x integration safety#67
romanindev merged 8 commits intomainfrom
feature/release-0-8-x-integration-safety

Conversation

@romanindev
Copy link
Copy Markdown
Contributor

Summary

This release introduces integration safety features to make service-to-service communication more predictable and robust.

Highlights

Response validation

Validate successful responses before they are returned:

const client = createClient({
  baseUrl: 'https://api.example.com',
  validateResponse(data) {
    return typeof data === 'object' && data !== null && 'id' in data;
  },
});
  • supports client-level defaults and request-level overrides
  • throws ValidationError on failure
  • does not affect HTTP error handling

Validation metadata in hooks

Validation results are exposed in lifecycle hooks:

afterResponse(ctx) {
  console.log(ctx.validation);
}

Idempotency key support

Attach idempotency keys to requests:

await client.post(
  '/payments',
  { amount: 100 },
  { idempotencyKey: 'payment-123' },
);

This adds:

idempotency-key: payment-123

Safer retries for non-idempotent requests

POST and PATCH requests are not retried unless:

  • the method is explicitly included in retry.retryMethods
  • idempotencyKey is provided

This prevents unsafe retries by default.

Changes

  • add response validation support
  • introduce ValidationError
  • expose validation result in hooks
  • add idempotency key support
  • improve retry safety for non-idempotent requests

Notes

  • no breaking changes
  • validation runs only after successful HTTP responses
  • validation failures are not retried by default

@romanindev romanindev changed the title Feature/release 0 8 x integration safety release: 0.8.x integration safety Apr 27, 2026
@romanindev romanindev merged commit 90a8625 into main Apr 28, 2026
1 check passed
@romanindev romanindev deleted the feature/release-0-8-x-integration-safety branch April 28, 2026 07:04
@romanindev romanindev mentioned this pull request Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant