Add OpenAPI/Swagger documentation

- Add Swagger dependencies to go.mod
- Annotate all API endpoints with Swagger comments
- Add Swagger UI at /api/v1/docs endpoint
- Auto-generate Swagger docs in Dockerfile build
- Update README with API documentation link
This commit is contained in:
2025-11-26 18:38:26 +01:00
parent 0019a4a095
commit 52ecc2fab5
7 changed files with 188 additions and 8 deletions
+19
View File
@@ -15,6 +15,25 @@ import (
"apocapoc-api/internal/infrastructure/persistence/sqlite"
)
// @title Apocapoc API
// @version 1.0
// @description Self-hosted habit tracking service
// @termsOfService http://swagger.io/terms/
// @contact.name API Support
// @contact.url https://github.com/davidfolch/apocapoc-api
// @license.name MIT
// @license.url https://opensource.org/licenses/MIT
// @host localhost:8080
// @BasePath /api/v1
// @securityDefinitions.apikey BearerAuth
// @in header
// @name Authorization
// @description Type "Bearer" followed by a space and JWT token.
func main() {
cfg, err := config.Load()
if err != nil {