Skip to content

Commit 92caeba

Browse files
committed
doc(swagger): add Swagger doc for all endpoints and reorganize routing
1. Add swagger documentation to all the endpoints. 2. Fix the status code of endpoints. 3. Make minor changes in DB schema. Signed-off-by: Gaurav Mishra <[email protected]>
1 parent 89a1655 commit 92caeba

File tree

14 files changed

+4412
-219
lines changed

14 files changed

+4412
-219
lines changed

.reuse/dep5

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2+
Upstream-Name: LicenseDB
3+
Source: https://github.com/fossology/LicenseDB/
4+
Upstream-Contact: FOSSology <[email protected]>
5+
Disclaimer: <text> This file is offered as-is, without any warranty. </text>
6+
7+
Files: cmd/laas/docs/*
8+
Copyright: Fossology contributors
9+
License: GPL-2.0-only

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,19 @@ go build ./cmd/laas
8686
```bash
8787
go run ./cmd/laas
8888
```
89+
90+
### Generating Swagger Documentation
91+
1. Install [swag](https://github.com/swaggo/swag) using the following command.
92+
```bash
93+
go install github.com/swaggo/swag/cmd/swag@latest
94+
```
95+
2. Run the following command to generate swagger documentation.
96+
```bash
97+
swag init --generalInfo api.go --dir ./pkg/api,./pkg/auth,./pkg/db,./pkg/models,./pkg/utils --output ./cmd/laas/docs
98+
```
99+
3. Swagger documentation will be generated in `./cmd/laas/docs` folder.
100+
4. Run the project and navigate to `http://localhost:8080/swagger/index.html` to view the documentation.
101+
5. Optionally, after changing any documentation comments, format them with following command.
102+
```bash
103+
swag fmt --generalInfo ./pkg/api/api.go --dir ./pkg/api,./pkg/auth,./pkg/db,./pkg/models,./pkg/utils
104+
```

0 commit comments

Comments
 (0)