Skip to content

Commit

Permalink
doc(swagger): add Swagger doc for all endpoints and reorganize routing
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
GMishx committed Dec 12, 2023
1 parent 12270f3 commit 2d25768
Show file tree
Hide file tree
Showing 14 changed files with 4,421 additions and 246 deletions.
9 changes: 9 additions & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: LicenseDB
Source: https://github.com/fossology/LicenseDB/
Upstream-Contact: FOSSology <[email protected]>
Disclaimer: <text> This file is offered as-is, without any warranty. </text>

Files: cmd/laas/docs/*
Copyright: Fossology contributors
License: GPL-2.0-only
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,19 @@ go build ./cmd/laas
```bash
go run ./cmd/laas
```

### Generating Swagger Documentation
1. Install [swag](https://github.com/swaggo/swag) using the following command.
```bash
go install github.com/swaggo/swag/cmd/swag@latest
```
2. Run the following command to generate swagger documentation.
```bash
swag init --generalInfo api.go --dir ./pkg/api,./pkg/auth,./pkg/db,./pkg/models,./pkg/utils --output ./cmd/laas/docs
```
3. Swagger documentation will be generated in `./cmd/laas/docs` folder.
4. Run the project and navigate to `http://localhost:8080/swagger/index.html` to view the documentation.
5. Optionally, after changing any documentation comments, format them with following command.
```bash
swag fmt --generalInfo ./pkg/api/api.go --dir ./pkg/api,./pkg/auth,./pkg/db,./pkg/models,./pkg/utils
```
Loading

0 comments on commit 2d25768

Please sign in to comment.