Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecates --with-context option #1806

Merged
merged 1 commit into from
Nov 28, 2018
Merged

Deprecates --with-context option #1806

merged 1 commit into from
Nov 28, 2018

Conversation

fredbi
Copy link
Contributor

@fredbi fredbi commented Nov 18, 2018

The command line flags remains active (older CLI scripts still work),
but the flag is ignored.

Templates are cleaned up from this unsupported variant, including stratoscale.

Signed-off-by: Frederic BIDON fredbi@yahoo.com

s := Server{
WithContext: true,
}
s.getOpts()

Choose a reason for hiding this comment

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

Error return value of s.getOpts is not checked

@codecov
Copy link

codecov bot commented Nov 18, 2018

Codecov Report

Merging #1806 into master will decrease coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1806      +/-   ##
==========================================
- Coverage   80.48%   80.47%   -0.02%     
==========================================
  Files          38       38              
  Lines        7543     7539       -4     
==========================================
- Hits         6071     6067       -4     
  Misses        996      996              
  Partials      476      476
Impacted Files Coverage Δ
generator/operation.go 89.09% <ø> (-0.04%) ⬇️
generator/shared.go 83.64% <ø> (ø) ⬆️
generator/structs.go 74.76% <ø> (ø) ⬆️
generator/support.go 88.65% <ø> (-0.08%) ⬇️
generator/bindata.go 68.34% <100%> (ø) ⬆️
cmd/swagger/commands/generate/server.go 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e8db9d9...3562576. Read the comment docs.

@fredbi fredbi force-pushed the fix-1684 branch 3 times, most recently from cf8eee3 to 5e6c30d Compare November 22, 2018 09:31
The command line flags remains active (older CLI scripts still work),
but the flag is ignored.

Templates are cleaned up from this unsupported variant, including stratoscale.

* fixes go-swagger#1684

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
@jawspeak
Copy link

Sorry for commenting on an old PR, but SEO results were not helpful to figure this out. This is a top result when searching for the deprecated command line flag --with-context when generating server handlers.

What's the way to generate handlers such that they can access the current request context?

@casualjim
Copy link
Member

You can get the request context from the HTTPRequest property on the generated XxxParams struct. You have full access to the net/http.Request there

@jawspeak
Copy link

jawspeak commented Jan 25, 2021

Amazing, I missed that! Thanks again @casualjim !

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.

swagger generation with --with-context result in compiles error
4 participants