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

feat: get swagger instance from register #1298

merged 1 commit into from Aug 19, 2022

feat: get swagger instance from register #1298

merged 1 commit into from Aug 19, 2022


Copy link

@rytsh rytsh commented Aug 17, 2022

Describe the PR
Problem starts if our swagger instance generated by CI and registered.
In main program if we want to modify some parameters inside of that instance is it not possible because code not in there.

Getting swagger instance with name from register it is easy to work with it, without need any workaround.

Swagger is an interface so we should do some casting but we know the our code and it should be this type.

if s, ok := swag.GetSwagger("swagger").(*swag.Spec); s != nil && ok {
	s.Version = "1.0.0"
	s.Title = "Test"

Relation issue

Signed-off-by: Eray Ates <>
Copy link

@ubogdan ubogdan left a comment

Choose a reason for hiding this comment

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


Copy link

codecov bot commented Aug 17, 2022

Codecov Report

Merging #1298 (11143e9) into master (23661ef) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #1298   +/-   ##
  Coverage   95.04%   95.05%           
  Files          14       14           
  Lines        2787     2791    +4     
+ Hits         2649     2653    +4     
  Misses         79       79           
  Partials       59       59           
Impacted Files Coverage Δ
swagger.go 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@ubogdan ubogdan merged commit cf03796 into swaggo:master Aug 19, 2022
12 checks passed
Copy link

ubogdan commented Aug 19, 2022

@rytsh Thanks for your contribution.

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

Successfully merging this pull request may close these issues.

None yet

2 participants