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

Add mechanism to programatically set general api info #220

Merged
merged 4 commits into from
Oct 2, 2018
Merged

Add mechanism to programatically set general api info #220

merged 4 commits into from
Oct 2, 2018

Conversation

bojand
Copy link
Contributor

@bojand bojand commented Sep 28, 2018

Describe the PR

  • Add dep files (Gopkg.lock and Gopkg.toml). Let me know if you want this removed please.
  • The generated docs package exports SwaggerInfo variable which has Version, Description, Title, Host and BasePath. Clients can set these:
// programatically set swagger info
docs.Title = "Swagger Example API"
docs.Description = "This is a sample server Petstore server."
docs.SwaggerInfo.Version = "1.0"
docs.SwaggerInfo.Host = "petstore.swagger.io"
docs.SwaggerInfo.BasePath = "/v2"
  • In the parser the default values for these are template value string ("{{.Title}}", "{{.Description}}", etc...). If they parser finds the value during parsing the defaults are replaces with the parsed value.

  • Added tests for the new parsing behaviour.

  • Added documentation to the README.md.

  • You can find sample usage using the new swag init on an simple echo project in this repo.

Relation issue
#215

@codecov-io
Copy link

codecov-io commented Sep 28, 2018

Codecov Report

Merging #220 into master will increase coverage by 0.05%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #220      +/-   ##
==========================================
+ Coverage   88.43%   88.49%   +0.05%     
==========================================
  Files           5        5              
  Lines        1029     1034       +5     
==========================================
+ Hits          910      915       +5     
  Misses         75       75              
  Partials       44       44
Impacted Files Coverage Δ
parser.go 87.6% <100%> (+0.12%) ⬆️

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 82de8d7...2bd5d1d. Read the comment docs.

Copy link
Member

@easonlin404 easonlin404 left a comment

Choose a reason for hiding this comment

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

@bojand Please remove dep files (Gopkg.lock and Gopkg.toml), I think that creating another PR to support vender management it a better idea, rest LGTM. Thanks your contributions. 💯

@easonlin404 easonlin404 merged commit 7b8e2c6 into swaggo:master Oct 2, 2018
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.

3 participants