You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@devlake.apache.org by GitBox <gi...@apache.org> on 2022/05/17 16:29:25 UTC
[GitHub] [incubator-devlake] xgdyp opened a new pull request, #1900: feat: add swagger-ui for lake
xgdyp opened a new pull request, #1900:
URL: https://github.com/apache/incubator-devlake/pull/1900
# Summary
<!--
Thanks for submitting a pull request!
We appreciate you spending the time to work on these changes.
Please fill out as many sections below as possible.
-->
### Key Points
- [x] This is a breaking change
- [ ] New or existing documentation is updated
### Description
This is a Draft PR for checking my work of adding swagger-ui is OK and I've finished most of the work except for polishing the description of each annotation.
Using swagger-ui, first, we need to install `swag cli` by
```$ go get -u github.com/swaggo/swag/cmd/swag```
also , we need to add `swag cli` to the path
and also need two package
```
# gin-swagger is a middleware package
$ go get github.com/swaggo/gin-swagger
# swagger is an inner-config package
$ go get github.com/swaggo/gin-swagger/swaggerFiles
```
these have been written in go.mod.
My work is adding annotations to /api directory. In api.go,we need to do some basic settings and register swagger router.
In Controler Files, we also need to add annotations for each function.
After that , run `swag init --parseDependency --parseInternal -o ./api/docs -g ./api/api.go` to generate swag-docs.
`--parseDependency --parseInternal ` aims to find models outside file. `-o ./api/docs` sets the generated docs in ./api/dos directory and `-g ./api/api.go` make swagger search api.go as an Enterance.
the command will generate three files as `docs.go` , `swagger.json` and `swagger.yaml` . These files are generated autoly
and can be ignored in formal version by using CI/CD tools.
Then we can see swagger page by enter URL `http://localhost:8080/swagger/index.html#/`. like
![image](https://user-images.githubusercontent.com/37795442/168861168-23ade2cb-f322-4d2e-8e83-ebb6542187b3.png)
In API we can see the input format and output format.
![image](https://user-images.githubusercontent.com/37795442/168861815-308b9833-406b-4b8a-babc-1bf95547aac5.png)
We can also try your own input data in this page.
![image](https://user-images.githubusercontent.com/37795442/168861699-eace3294-595e-4a93-9d0f-4d38eb3ebed6.png)
### Does this close any open issues?
related to #292
### Current Behavior
finish most of this feat
### New Behavior
continue processing the description.
### Screenshots
Include any relevant screenshots here.
### Other Information
Any other information that is important to this PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] klesh commented on pull request #1900: feat: add swagger-ui for lake
Posted by GitBox <gi...@apache.org>.
klesh commented on PR #1900:
URL: https://github.com/apache/incubator-devlake/pull/1900#issuecomment-1129613476
This is an excellent implematation!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] warren830 merged pull request #1900: feat: add swagger-ui for lake
Posted by GitBox <gi...@apache.org>.
warren830 merged PR #1900:
URL: https://github.com/apache/incubator-devlake/pull/1900
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] xgdyp commented on pull request #1900: feat: add swagger-ui for lake
Posted by GitBox <gi...@apache.org>.
xgdyp commented on PR #1900:
URL: https://github.com/apache/incubator-devlake/pull/1900#issuecomment-1131691479
ready for review!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org