fix: make anonymous security alternatives optional - #4081
Conversation
Move the anonymous `{}` security alternative into a dedicated fixture/test instead of modifying the existing API key examples.
|
Warning Review limit reached
Next review available in: 23 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
💻 Website PreviewThe latest changes are available as preview in: https://pr-4081.fets-3ku.pages.dev |
✅ Benchmark Results |
There was a problem hiding this comment.
Pull request overview
This PR updates the fets client type generation so that when an OpenAPI operation’s security array includes an anonymous alternative ({}), the generated auth-related request params become optional (reflecting that callers may omit credentials). It also adds targeted fixture/test coverage and a changeset entry for the patch release.
Changes:
- Add type-level detection for an anonymous
{}security requirement and make the derived auth params optional in that case. - Add a dedicated fixture + compile-time client usage test covering optional API key auth via anonymous security alternative.
- Add a changeset documenting the behavior change as a patch.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/fets/src/client/types.ts | Detects {} in security alternatives and makes derived auth params optional via DeepPartial when anonymous access is allowed. |
| packages/fets/tests/client/optional-apiKey-test.ts | Adds a compile-time client usage test demonstrating that auth params are optional when security includes {}. |
| packages/fets/tests/client/fixtures/example-optional-apiKey-header-oas.ts | Adds an OpenAPI fixture with security: [{}, { apiKey: [] }] to represent optional authentication. |
| .changeset/optional-anonymous-security.md | Documents the patch change for release notes/versioning. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
securityrequirements ({}) so auth params are optional when anonymous access is allowedoptional-apiKey-test.ts) instead of changing the existing API key examplesBased on #3959 by @kriptoburak, rebased on current
masterand updated per review feedback.Test plan
npm run ts:check