refactor(ui): migrate API client codegen from hey-api to orval - #7023
Draft
luizhf42 wants to merge 3 commits into
Draft
refactor(ui): migrate API client codegen from hey-api to orval#7023luizhf42 wants to merge 3 commits into
luizhf42 wants to merge 3 commits into
Conversation
Orval replaces `@hey-api/openapi-ts` as the OpenAPI client generator. The config enables react-query hooks, and MSW/faker mock generation from the spec. The custom mutator merges `fetchClient` and `fetchInterceptors` into a single function that handles auth, JWT expiry, 401/MFA, connectivity tracking, and error enrichment. `fetchWithResponse` is exported alongside for paginated hooks that need access to response headers.
Delete 11 single-purpose query hooks and trim query exports from 2 mixed files, updating ~20 call sites to import directly from the generated `@/client/api` module.
…lidates` Orval's `mutationInvalidates` config auto-generates `onSuccess` invalidation inside each mutation hook, making the hand-written thin wrappers redundant. This commit drops Zod runtime validation (unused — zero `.parse()` calls across 6 400 generated lines), removes the `inlineParameterRefs` transformer that only existed as a Zod workaround, wires up `mutationInvalidates` for every mutation→query relationship, deletes 17 invalidation-only hook files plus 5 obsolete test files, and trims 6 mixed files down to only the hooks carrying real logic. All call sites now import generated hooks directly from `@/client/api`.
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.
Warning
WIP — this branch is under active development and not ready for review.
Migrates the console's OpenAPI client codegen from
@hey-api/openapi-tsto Orval. Tracked in shellhub-io/team#236.Done
orval+ config,customInstance.tsmutator, updatedgenerate-client.sh, adaptedtsconfig.jsonmutationInvalidatesconfig for all mutation→query relationships, deleted 17 invalidation-only hook files + 5 obsolete test files, trimmed 6 mixed hooks to custom-logic only, dropped unused Zod runtime validation and its transformer workaround. All call sites rewired to@/client/api.Left
@/clientbarrel to@/client/apimockSdkGeninfrastructure@faker-js/fakerto devDependenciessdk.genreferences@hey-api/openapi-tsdependency