fix(analyzer): a security scheme the generator cannot use costs the whole client - #64
Merged
Merged
Conversation
…hole client A spec declaring openIdConnect or mutualTLS failed generation outright, as did `scheme: Bearer` with a capital B, which RFC 7235 makes equivalent to `bearer`. Any API behind Keycloak, Auth0, or Entra was unusable over one declaration the caller may not even authenticate with. OpenID Connect is a bearer token on the wire, so it generates the bearer provider. mutualTLS is configured on the transport and gets none. Anything else unrecognized, including an unknown http scheme, now warns on stderr and generates the rest of the client. Warnings ride on ir.Package so the analyzer stays free of output concerns.
This was referenced Aug 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #62.
Two shapes stopped generation entirely:
No client at all, over one declaration the caller may not even be authenticating with. Any API fronted by Keycloak, Auth0, or Entra declares OIDC, and
scheme: Bearerwith a capital B is equivalent tobearerunder RFC 7235, which registers auth scheme names case-insensitively.Behavior now
type: openIdConnectscheme: Bearertype: mutualTLSscheme: digesttypeOpenID Connect is a bearer token on the wire; the discovery document is the caller's concern, not the transport's. mutualTLS is configured on the
http.Client, so there is nothing for a provider to add to a request.Unsupported schemes warn rather than pass silently, since a client with no provider for a scheme the API requires would otherwise look like it authenticates and 401:
Warnings collect on
ir.Packageand the CLI prints them to stderr, so the analyzer stays free of output concerns. That channel is reusable for anything else the generator has to skip.I did not carry
openIdConnectUrlinto the IR. Nothing renders per-scheme metadata today, so it would be a field with no reader.Tests
internal/analyzer/security_test.gocovers a spec declaring all five shapes at once:openIdConnectandBearerproduce bearer providers,digest,mutualTLS, and an unrecognized type produce no provider and one warning each, and analysis returns no error.gofmt,go vet ./..., andgo test ./...pass.