GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Deprecate ctx based security scopes by mromaszewicz · Pull Request #2440 · oapi-codegen/oapi-codegen Conversation
Member
Generated server code no longer embeds security scheme scopes into the request context. The per-scheme context key types (e.g.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Generated server code no longer embeds security scheme scopes into the
request context. The per-scheme context key types (e.g.
`bearerAuthContextKey`), scope constants (e.g. `BearerAuthScopes`), and
per-operation context stores flattened the spec's `security`
requirements and could not represent alternative (OR), combined (AND),
or anonymous (`{}`) schemes. Authentication should instead use the
request validation middleware, which evaluates the spec's security
requirements directly. See oapi-codegen#1524.
- Add `compatibility.enable-auth-scopes-on-context` (default off) to
restore the legacy emission, and document it in the README and
configuration schema
- Gate all emission sites on the new option: security scheme context
key types, scope constants, and the context stores in the chi,
gorilla, stdhttp, echo, echo/v5, iris, fiber, and gin templates
- Opt the fiber middleware fixture into the option so the issue-518
anonymous-alternative regression stays meaningful; its generated
output is unchanged
- Add TestEnableAuthScopesOnContext covering both option states
- Regenerate; affected fixtures and examples lose only the now-dead
scope artifacts. The authenticated-api examples already authenticate
via the validation middleware and are otherwise unaffected
Contributor
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes. --- ### Issue 1 of 1 pkg/codegen/codegen_test.go:493-514 **Test coverage limited to a single backend** `TestEnableAuthScopesOnContext` only exercises `StdHTTPServer`. All seven backend templates (chi, echo, echo/v5, fiber, gin, gorilla, iris) had guard changes in this PR, and any future template-level regression (e.g., the `if`/`range` ordering in `echo-wrappers.tmpl`) would go undetected. At minimum, adding `EchoServer: true` as a second sub-test case (reusing the same spec) would catch divergence between the chi/gorilla/stdhttp pattern (`if and … opts.Compatibility`) and the echo/gin/iris/fiber pattern (outer `if opts.Compatibility`, inner `range`) that are structurally different in the templates. Reviews (1): Last reviewed commit: "Deprecate ctx based security scopes" | Re-trigger Greptile All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+493
to
+514
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Prompt To Fix With AIThis is a comment left during a code review. Path: pkg/codegen/codegen_test.go Line: 493-514 Comment: **Test coverage limited to a single backend** `TestEnableAuthScopesOnContext` only exercises `StdHTTPServer`. All seven backend templates (chi, echo, echo/v5, fiber, gin, gorilla, iris) had guard changes in this PR, and any future template-level regression (e.g., the `if`/`range` ordering in `echo-wrappers.tmpl`) would go undetected. At minimum, adding `EchoServer: true` as a second sub-test case (reusing the same spec) would catch divergence between the chi/gorilla/stdhttp pattern (`if and … opts.Compatibility`) and the echo/gin/iris/fiber pattern (outer `if opts.Compatibility`, inner `range`) that are structurally different in the templates. How can I resolve this? If you propose a fix, please make it concise. Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsUh oh!
There was an error while loading. Please reload this page.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
☢️ breaking change
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. 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. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |