Skip to content

feature(std-http-server): option to inject request metadata into context#2070

Open
chaseisabelle wants to merge 4 commits into
oapi-codegen:mainfrom
chaseisabelle:feature/inject-request-metadata-into-context
Open

feature(std-http-server): option to inject request metadata into context#2070
chaseisabelle wants to merge 4 commits into
oapi-codegen:mainfrom
chaseisabelle:feature/inject-request-metadata-into-context

Conversation

@chaseisabelle
Copy link
Copy Markdown
Contributor

@chaseisabelle chaseisabelle commented Aug 30, 2025

Added an option to inject request metadata into the context for the std-http-server. This will be useful for downstream logging, metrics, tracing, observability, and custom authorization implementations.

Checklist:

  • All make commands (tidy, test, generate, and lint) have been run ✅
  • Default is false/off to preserve existing behavior ✅
  • Added test cases and mock std-http-server ✅
  • Generated code has been committed for review ✅

Example:

// set the option to enable metadata context injection
han := oapi.HandlerWithOptions(srv, StdHTTPServerOptions{
  WithRequestMetadata: true,
})
// get the injected metadata from the context 
md := oapi.RequestMetadataFromContext(ctx)

opID := md.OperationID
path := md.RequestRoute

@chaseisabelle chaseisabelle requested a review from a team as a code owner August 30, 2025 16:58
@kusari-inspector
Copy link
Copy Markdown

kusari-inspector Bot commented Aug 30, 2025

Kusari Inspector

Kusari Analysis Results:

Proceed with these changes

✅ No Flagged Issues Detected
All values appear to be within acceptable risk parameters.

No pinned version dependency changes, code issues or exposed secrets detected!

Note

View full detailed analysis result for more information on the output and the checks that were run.


@kusari-inspector rerun - Trigger a re-analysis of this PR
@kusari-inspector feedback [your message] - Send feedback to our AI and team
See Kusari's documentation for setup and configuration.
Commit: 54c773c, performed at: 2025-09-28T04:16:46Z

Found this helpful? Give it a 👍 or 👎 reaction!

@chaseisabelle chaseisabelle marked this pull request as draft August 30, 2025 17:00
@chaseisabelle chaseisabelle marked this pull request as ready for review August 30, 2025 23:51
@kusari-inspector
Copy link
Copy Markdown

Kusari PR Analysis rerun based on - c19ae60 performed at: 2025-09-13T21:06:03Z - link to updated analysis

@kusari-inspector
Copy link
Copy Markdown

Kusari PR Analysis rerun based on - 54c773c performed at: 2025-09-28T04:17:03Z - link to updated analysis

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