chore(db): add pre-commit for swagger documentation
Signed-off-by: Klagarge <remi@heredero.ch>
This commit is contained in:
9
.pre-commit-config.yaml
Normal file
9
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
repos:
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: swag-init
|
||||||
|
name: swag init
|
||||||
|
entry: bash -c 'export PATH=$PATH:$(go env GOPATH)/bin && cd db/src && swag init'
|
||||||
|
language: system
|
||||||
|
files: ^db/src/.*\.go$
|
||||||
|
pass_filenames: false
|
||||||
11
db/README.md
11
db/README.md
@@ -21,7 +21,18 @@ docker compose up -d
|
|||||||
## Development
|
## Development
|
||||||
|
|
||||||
### Swagger Documentation
|
### Swagger Documentation
|
||||||
|
To ensure the Swagger documentation is always up to date, we use [pre-commit](https://pre-commit.com/). It runs `swag init` automatically before each commit if any Go files in `db/src` have changed.
|
||||||
|
|
||||||
|
To install the hooks:
|
||||||
|
```bash
|
||||||
|
pre-commit install
|
||||||
|
```
|
||||||
|
|
||||||
|
Alternatively, you can run it manually:
|
||||||
|
```bash
|
||||||
|
pre-commit run --all-files
|
||||||
|
```
|
||||||
|
or from `db/src`:
|
||||||
```bash
|
```bash
|
||||||
swag init
|
swag init
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user