Skip to content

feat: client-side auth - #21

Merged
dotkas merged 2 commits into
mainfrom
dotkas/client-side-auth
Jul 7, 2026
Merged

feat: client-side auth#21
dotkas merged 2 commits into
mainfrom
dotkas/client-side-auth

Conversation

@dotkas

@dotkas dotkas commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings July 7, 2026 18:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds client-side authentication support to the blocking reqwest client generator by lowering OpenAPI securitySchemes into the IR and emitting per-scheme credential fields + setters that are applied per operation based on effective security requirements.

Changes:

  • Extend IR and lowering to carry document-level security schemes and per-operation effective security keys.
  • Teach the reqwest client emitter to generate optional credential fields, with_<scheme> setters, and per-request auth mutations; reject unsupported schemes (oauth2/oidc) via fixtures.
  • Add new snapshot + integration-style test coverage for auth credential placement and update README/coverage docs accordingly.

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
README.md Documents client-side security scheme support and deferred oauth2/oidc.
crates/oapi-codegen/tests/generated/client_auth.rs Adds generated snapshot exercising bearer/basic/apiKey auth emission.
crates/oapi-codegen/tests/generated_compiles.rs Compiles new auth snapshot and adds a wire-level test for credential application.
crates/oapi-codegen/tests/fixtures/client_unsupported_oauth2.yaml New fixture proving oauth2 is rejected by the client generator.
crates/oapi-codegen/tests/fixtures/client_auth.yaml New fixture covering bearer/basic + apiKey header/query/cookie + security: [].
crates/oapi-codegen/tests/coverage.rs Updates supported-surface tracking and fixture lists for client auth.
crates/oapi-codegen/src/lower/security.rs New lowering module for security scheme catalog + effective requirements.
crates/oapi-codegen/src/lower/paths.rs Populates Operation::security and prunes service-level schemes to “used”.
crates/oapi-codegen/src/lower/mod.rs Exposes the new lower::security module.
crates/oapi-codegen/src/loader.rs Adds accessors for global security and component securitySchemes.
crates/oapi-codegen/src/ir.rs Extends IR with Service.security_schemes and security scheme/kind modeling.
crates/oapi-codegen/src/emit/reqwest.rs Emits credential fields/setters and applies auth to requests; rejects unsupported schemes.

Comment thread crates/oapi-codegen/src/lower/security.rs
Comment thread crates/oapi-codegen/src/lower/security.rs
Comment thread crates/oapi-codegen/src/lower/paths.rs Outdated
Comment thread crates/oapi-codegen/src/emit/reqwest.rs Outdated
@dotkas
dotkas enabled auto-merge (squash) July 7, 2026 18:55
@dotkas
dotkas merged commit ecd4a82 into main Jul 7, 2026
5 checks passed
@dotkas
dotkas deleted the dotkas/client-side-auth branch July 7, 2026 18:55
@dotkas dotkas removed the released label Jul 16, 2026
@alchemaxinc alchemaxinc deleted a comment from alchemax-housekeeper Bot Jul 16, 2026
@alchemax-housekeeper

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.0.0-dev.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@alchemax-housekeeper

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants