Skip to content

fix(openapi): add missing fields to admin user endpoints#6100

Merged
gustavosbarreto merged 1 commit intomasterfrom
fix/openapi-admin-user-fields
Apr 1, 2026
Merged

fix(openapi): add missing fields to admin user endpoints#6100
gustavosbarreto merged 1 commit intomasterfrom
fix/openapi-admin-user-fields

Conversation

@luizhf42
Copy link
Copy Markdown
Member

@luizhf42 luizhf42 commented Mar 31, 2026

What

Aligned the OpenAPI spec for admin user endpoints with what the Go backend actually returns.

Why

The generated TypeScript SDK was missing fields that the backend sends, forcing the React UI to use type casts and intersection types as workarounds. The status enum also listed pending instead of the real not-confirmed value.
Closes #6088

Changes

  • UserAdminResponse (userAdminResponse.yaml): replaced stale confirmed: boolean with status: string (enum: confirmed, not-confirmed). Added max_namespaces: integer and email_marketing: boolean. Made status required.
  • GET /admin/api/users/{id} (admin@api@users@{id}.yaml): added admin: boolean (required). Fixed status enum from [confirmed, pending] to [confirmed, not-confirmed] to match the Go UserStatus constants.
  • Examples: updated both list and detail endpoint examples to reflect the new fields.

email_marketing was intentionally left out of the detail endpoint — the cloud UserGet response struct doesn't include it. The list endpoint returns []models.User directly, which does include the field.

@luizhf42 luizhf42 requested a review from a team as a code owner March 31, 2026 16:50
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 31, 2026

Claude finished @luizhf42's task in 4m 3s —— View job


Code Review Complete

Reviewed 3 files. 1 inline issue posted (high severity).

The status enum fix (not-confirmed instead of pending) and the addition of admin to the detail endpoint are correct and align with the Go backend. The core issue is that email_marketing was added to the GET /admin/api/users/{id} OpenAPI spec, but the Go response struct (UserGet in cloud/internal/admin/pkg/responses/user.go) doesn't include this field — so the spec documents a field the backend never returns. The fix is either to add the field to the Go struct or remove it from the detail endpoint spec until the backend catches up.


If you've addressed the feedback and want a new review, tag @shellhub-io/admin and a team member can trigger it.

@luizhf42 luizhf42 force-pushed the fix/openapi-admin-user-fields branch from c6aac2e to a2239a0 Compare March 31, 2026 16:51
@luizhf42 luizhf42 force-pushed the fix/openapi-admin-user-fields branch from a2239a0 to 8dcf71b Compare March 31, 2026 17:02
@luizhf42 luizhf42 self-assigned this Mar 31, 2026
@luizhf42 luizhf42 added product/enterprise Issue/PR related to Enterprise Edition openapi labels Mar 31, 2026
@gustavosbarreto
Copy link
Copy Markdown
Member

/review

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 31, 2026

Claude finished @gustavosbarreto's task in 13m 38s —— View job


Code Review Complete

Reviewed 3 files across code quality, security, testing, language patterns, and architecture — no issues found. The code looks good as-is.

The changes correctly align the OpenAPI spec with the Go backend:

  • status enum (confirmed, not-confirmed) matches UserStatusConfirmed / UserStatusNotConfirmed constants
  • admin addition to the detail endpoint matches UserGet.Admin in cloud/internal/admin/pkg/responses/user.go
  • email_marketing correctly included only in the list endpoint schema (where []models.User is returned directly) and excluded from the detail endpoint (where UserGet — which omits this field — is used)
  • Examples and required fields are consistent with the schema changes

If you push additional changes and want a new review, tag @shellhub-io/admin and a team member can trigger it.

Add status field to UserAdminResponse and admin field to the
GET /admin/api/users/{id} response. Both fields are returned by the Go
backend but were missing from the OpenAPI spec, forcing the React UI to
use type workarounds.

Also adds email_marketing to both schemas and fixes the status enum from
[confirmed, pending] to [confirmed, not-confirmed] to match the actual
UserStatus constants in the backend.

Fixes: #6088
@luizhf42 luizhf42 force-pushed the fix/openapi-admin-user-fields branch from 8dcf71b to 117228e Compare April 1, 2026 12:18
@gustavosbarreto gustavosbarreto merged commit 27427be into master Apr 1, 2026
23 checks passed
@gustavosbarreto gustavosbarreto deleted the fix/openapi-admin-user-fields branch April 1, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

openapi product/enterprise Issue/PR related to Enterprise Edition

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(openapi): add missing fields to admin user endpoints

2 participants