chore(db): add pre-commit for swagger documentation

Signed-off-by: Klagarge <remi@heredero.ch>
This commit is contained in:
2026-05-03 19:18:06 +02:00
parent 790961b15a
commit 50583bb79b
2 changed files with 20 additions and 0 deletions

9
.pre-commit-config.yaml Normal file
View 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

View File

@@ -21,7 +21,18 @@ docker compose up -d
## Development
### 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
swag init
```