From 43453fc15f38b5bfae378887dae93b521e635dc5 Mon Sep 17 00:00:00 2001 From: luizhf42 Date: Fri, 4 Sep 2026 17:15:26 -0300 Subject: [PATCH] fix(server): return 204 from `registerUser` when no auth is issued The handler returned 200 with an empty body for open registrations (no invitation `sig`). The OpenAPI spec declared no response schema, so codegen tools typed the return as `void`. The invited-user path that does return `UserAuthResponse` was undocumented. Split into 200 (with `userAuth` schema, invitation flow) and 204 (no body, open registration) so the generated client carries the correct return type and `customInstance` handles the empty response through its existing 204 path. --- openapi/spec/paths/api@register.yaml | 12 +++++++++++- server/api/routes/invitation.go | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/openapi/spec/paths/api@register.yaml b/openapi/spec/paths/api@register.yaml index 3cd039930c0..2790cf40a4c 100644 --- a/openapi/spec/paths/api@register.yaml +++ b/openapi/spec/paths/api@register.yaml @@ -59,7 +59,17 @@ post: - email_marketing responses: '200': - description: User registered successfully + description: | + Invitation-based registration where the user is auto-confirmed. + Returns session credentials so the client can log in immediately. + content: + application/json: + schema: + $ref: ../components/schemas/userAuth.yaml + '204': + description: | + Open registration completed. The account requires email confirmation + before the user can log in. '400': $ref: ../components/responses/400.yaml '401': diff --git a/server/api/routes/invitation.go b/server/api/routes/invitation.go index 56cd106942c..17c97ec5676 100644 --- a/server/api/routes/invitation.go +++ b/server/api/routes/invitation.go @@ -44,7 +44,7 @@ func (h *Handler) RegisterUser(c *gateway.Context) error { return c.JSON(http.StatusOK, authInfo) } - return c.NoContent(http.StatusOK) + return c.NoContent(http.StatusNoContent) } // ResolveInvitation serves what an invite code stands for, so the accept page can route the