Skip to content

Commit

Permalink
Improve swagger generation
Browse files Browse the repository at this point in the history
These issues are causing ogen-api to fail after I used the swagger
converter.
  • Loading branch information
kusold committed Dec 8, 2024
1 parent 2d2e3fe commit a554f87
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/partial-backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@ jobs:

- name: Test
run: task go:coverage

- name: Validate OpenAPI definition
uses: swaggerexpert/swagger-editor-validate@v1
with:
definition-file: backend/app/api/static/docs/swagger.json
16 changes: 15 additions & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ tasks:
- "./backend/internal/data/**"
- "./backend/internal/core/services/**/*"
- "./backend/app/tools/typegen/main.go"

typescript-types:
desc: Generates typescript types from swagger definition
cmds:
Expand Down Expand Up @@ -116,6 +115,21 @@ tasks:
cmds:
- cd backend && go run app/tools/migrations/main.go {{ .CLI_ARGS }}

db:migration:postgresql:
env:
HBOX_DATABASE_DRIVER: postgres
HBOX_DATABASE_USERNAME: homebox
HBOX_DATABASE_PASSWORD: homebox
HBOX_DATABASE_DATABASE: homebox
HBOX_DATABASE_HOST: localhost
HBOX_DATABASE_PORT: 5432
HBOX_DATABASE_SSL_MODE: disable
desc: Runs the database diff engine to generate a SQL migration files for postgresql
deps:
- db:generate
cmds:
- cd backend && go run app/tools/migrations/main.go {{ .CLI_ARGS }}

ui:watch:
desc: Starts the vitest test runner in watch mode
dir: frontend
Expand Down
2 changes: 2 additions & 0 deletions backend/app/api/handlers/v1/v1_ctrl_maint_entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
// @Summary Get Maintenance Log
// @Tags Item Maintenance
// @Produce json
// @Param id path string true "Item ID"
// @Param filters query repo.MaintenanceFilters false "which maintenance to retrieve"
// @Success 200 {array} repo.MaintenanceEntryWithDetails[]
// @Router /v1/items/{id}/maintenance [GET]
Expand All @@ -33,6 +34,7 @@ func (ctrl *V1Controller) HandleMaintenanceLogGet() errchain.HandlerFunc {
// @Summary Create Maintenance Entry
// @Tags Item Maintenance
// @Produce json
// @Param id path string true "Item ID"
// @Param payload body repo.MaintenanceEntryCreate true "Entry Data"
// @Success 201 {object} repo.MaintenanceEntry
// @Router /v1/items/{id}/maintenance [POST]
Expand Down
1 change: 1 addition & 0 deletions backend/app/api/handlers/v1/v1_ctrl_maintenance.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func (ctrl *V1Controller) HandleMaintenanceGetAll() errchain.HandlerFunc {
// @Summary Update Maintenance Entry
// @Tags Maintenance
// @Produce json
// @Param id path string true "Maintenance ID"
// @Param payload body repo.MaintenanceEntryUpdate true "Entry Data"
// @Success 200 {object} repo.MaintenanceEntry
// @Router /v1/maintenance/{id} [PUT]
Expand Down
1 change: 0 additions & 1 deletion backend/app/api/handlers/v1/v1_ctrl_notifiers.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ func (ctrl *V1Controller) HandleUpdateNotifier() errchain.HandlerFunc {
// @Summary Test Notifier
// @Tags Notifiers
// @Produce json
// @Param id path string true "Notifier ID"
// @Param url query string true "URL"
// @Success 204
// @Router /v1/notifiers/test [POST]
Expand Down

0 comments on commit a554f87

Please sign in to comment.