feat(ui): spec billing/portal, saml/reauth and ws/ssh/session - #6924
Merged
Conversation
Add the three missing OpenAPI path files and wire them into the community, cloud and combined spec roots so `@hey-api/openapi-ts` generates typed operations for each route. Replace the hand-written wrappers in `unspeccedRoutes.ts` with the generated SDK calls at every console call site (`useBilling`, `SSHApproval`, `TerminalInstance`) and delete the module and its test. Fixes: shellhub-io/team#218
|
Claude finished @luizhf42's task in 6m 23s —— View job Code Review CompleteReviewed 12 files across code quality, security, testing, language patterns, and architecture — no new issues found. The code looks good as-is. A few things I specifically verified that hold up well:
If you push additional changes and want a new review, tag |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds OpenAPI path specs for the three routes
unspeccedRoutes.tswas covering by hand (POST /api/billing/portal,GET /api/user/saml/reauth,POST /ws/ssh/session), so@hey-api/openapi-tsgenerates typed operations for them. The hand-written wrappers and their test are deleted; every console call site now uses the generated SDK.Why
These routes were left out of the spec when #6919 merged the console onto a single HTTP transport. The hand-typed request/response shapes in
unspeccedRoutes.tscould drift silently from the Go handlers, and/ws/ssh/sessionwas subject to response validation with no schema to validate against.Closes shellhub-io/team#218
Changes
openapi/spec/paths/: three new path files, each modeled after its nearest sibling (api@billing@subscription.yaml,api@user@saml@auth.yaml,api@auth@ssh.yaml).ws@ssh@session.yamlusesoneOfto enforce the mutual exclusion between password and fingerprint auth.openapi/spec/{cloud,community,openapi}.yaml: wired the new paths into the cloud, community, and combined spec roots.ui/apps/console/src/hooks/useBilling.ts:useOpenBillingPortalcalls the generatedcreateBillingPortalSessioninstead ofgetBillingPortal.ui/apps/console/src/pages/SSHApproval.tsx:startSsocalls the generatedgetSamlReauthUrlwith{ query, throwOnError }.ui/apps/console/src/components/terminal/TerminalInstance.tsx:connectbuilds the body as a discriminated union (CreateWebSshSessionData["body"]) and calls the generatedcreateWebSshSession.ui/apps/console/src/api/unspeccedRoutes.tsand its test: deleted.ui/apps/console/src/hooks/__tests__/useBilling.test.ts: mock target changed from the deleted module to@/client.Testing
tsc -bpasses — the generated union type forws/ssh/sessioncatches any mismatch between the spec and the console's conditional body construction./api/billing/portaland/api/user/saml/reauth;/ws/ssh/sessionwas already non-exempt inopenAPIValidationSkipperand now has a schema to validate against.