diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-02-14 20:32:47 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-02-14 20:32:47 +0900 |
| commit | 9185367fcd7d95af89fac36dd892d8b064dbd94f (patch) | |
| tree | 6085f0c4ab695d0f83348f32b49b5481f1da6548 /backend/api/handler_wrapper.go | |
| parent | 6bd35e345a4c5d74578b0f8a5c969027e7e15f02 (diff) | |
| download | phperkaigi-2026-albatross-9185367fcd7d95af89fac36dd892d8b064dbd94f.tar.gz phperkaigi-2026-albatross-9185367fcd7d95af89fac36dd892d8b064dbd94f.tar.zst phperkaigi-2026-albatross-9185367fcd7d95af89fac36dd892d8b064dbd94f.zip | |
feat(openapi): generate OpenAPI specs from TypeSpec sources
Migrate hand-written OpenAPI YAML to TypeSpec (.tsp) source files.
TypeSpec compiles to OpenAPI 3.0 YAML, enabling type-safe API definitions.
- Add typespec/ directory with api-server and fortee definitions
- Integrate TypeSpec build into `just gen` and `just build` pipelines
- Update backend handler code to match new generated type names
(inlined error responses, separate GameType/ProblemLanguage enums)
- Regenerate frontend TypeScript types from new OpenAPI output
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'backend/api/handler_wrapper.go')
| -rw-r--r-- | backend/api/handler_wrapper.go | 40 |
1 files changed, 10 insertions, 30 deletions
diff --git a/backend/api/handler_wrapper.go b/backend/api/handler_wrapper.go index b88ddb2..5feaac7 100644 --- a/backend/api/handler_wrapper.go +++ b/backend/api/handler_wrapper.go @@ -29,9 +29,7 @@ func (h *HandlerWrapper) GetGame(ctx context.Context, request GetGameRequestObje user, ok := GetJWTClaimsFromContext(ctx) if !ok { return GetGame401JSONResponse{ - UnauthorizedJSONResponse: UnauthorizedJSONResponse{ - Message: "Unauthorized", - }, + Message: "Unauthorized", }, nil } return h.impl.GetGame(ctx, request, user) @@ -41,9 +39,7 @@ func (h *HandlerWrapper) GetGamePlayLatestState(ctx context.Context, request Get user, ok := GetJWTClaimsFromContext(ctx) if !ok { return GetGamePlayLatestState401JSONResponse{ - UnauthorizedJSONResponse: UnauthorizedJSONResponse{ - Message: "Unauthorized", - }, + Message: "Unauthorized", }, nil } return h.impl.GetGamePlayLatestState(ctx, request, user) @@ -53,9 +49,7 @@ func (h *HandlerWrapper) GetGameWatchLatestStates(ctx context.Context, request G user, ok := GetJWTClaimsFromContext(ctx) if !ok { return GetGameWatchLatestStates401JSONResponse{ - UnauthorizedJSONResponse: UnauthorizedJSONResponse{ - Message: "Unauthorized", - }, + Message: "Unauthorized", }, nil } return h.impl.GetGameWatchLatestStates(ctx, request, user) @@ -65,9 +59,7 @@ func (h *HandlerWrapper) GetGameWatchRanking(ctx context.Context, request GetGam user, ok := GetJWTClaimsFromContext(ctx) if !ok { return GetGameWatchRanking401JSONResponse{ - UnauthorizedJSONResponse: UnauthorizedJSONResponse{ - Message: "Unauthorized", - }, + Message: "Unauthorized", }, nil } return h.impl.GetGameWatchRanking(ctx, request, user) @@ -77,9 +69,7 @@ func (h *HandlerWrapper) GetGames(ctx context.Context, request GetGamesRequestOb user, ok := GetJWTClaimsFromContext(ctx) if !ok { return GetGames401JSONResponse{ - UnauthorizedJSONResponse: UnauthorizedJSONResponse{ - Message: "Unauthorized", - }, + Message: "Unauthorized", }, nil } return h.impl.GetGames(ctx, request, user) @@ -89,9 +79,7 @@ func (h *HandlerWrapper) GetMe(ctx context.Context, request GetMeRequestObject) user, ok := GetJWTClaimsFromContext(ctx) if !ok { return GetMe401JSONResponse{ - UnauthorizedJSONResponse: UnauthorizedJSONResponse{ - Message: "Unauthorized", - }, + Message: "Unauthorized", }, nil } return h.impl.GetMe(ctx, request, user) @@ -101,9 +89,7 @@ func (h *HandlerWrapper) GetTournament(ctx context.Context, request GetTournamen user, ok := GetJWTClaimsFromContext(ctx) if !ok { return GetTournament401JSONResponse{ - UnauthorizedJSONResponse: UnauthorizedJSONResponse{ - Message: "Unauthorized", - }, + Message: "Unauthorized", }, nil } return h.impl.GetTournament(ctx, request, user) @@ -113,9 +99,7 @@ func (h *HandlerWrapper) PostGamePlayCode(ctx context.Context, request PostGameP user, ok := GetJWTClaimsFromContext(ctx) if !ok { return PostGamePlayCode401JSONResponse{ - UnauthorizedJSONResponse: UnauthorizedJSONResponse{ - Message: "Unauthorized", - }, + Message: "Unauthorized", }, nil } return h.impl.PostGamePlayCode(ctx, request, user) @@ -125,9 +109,7 @@ func (h *HandlerWrapper) PostGamePlaySubmit(ctx context.Context, request PostGam user, ok := GetJWTClaimsFromContext(ctx) if !ok { return PostGamePlaySubmit401JSONResponse{ - UnauthorizedJSONResponse: UnauthorizedJSONResponse{ - Message: "Unauthorized", - }, + Message: "Unauthorized", }, nil } return h.impl.PostGamePlaySubmit(ctx, request, user) @@ -141,9 +123,7 @@ func (h *HandlerWrapper) PostLogout(ctx context.Context, request PostLogoutReque user, ok := GetJWTClaimsFromContext(ctx) if !ok { return PostLogout401JSONResponse{ - UnauthorizedJSONResponse: UnauthorizedJSONResponse{ - Message: "Unauthorized", - }, + Message: "Unauthorized", }, nil } return h.impl.PostLogout(ctx, request, user) |
