From 9185367fcd7d95af89fac36dd892d8b064dbd94f Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 14 Feb 2026 20:32:47 +0900 Subject: 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 --- backend/api/handler_wrapper.go | 40 ++++++++++------------------------------ 1 file changed, 10 insertions(+), 30 deletions(-) (limited to 'backend/api/handler_wrapper.go') 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) -- cgit v1.3.1