feat(web): OpenAPI full fetch client (PLAN §4.2)#16
Merged
Conversation
- Add @hey-api/openapi-ts with openapi-ts.config.ts; commit generated SDK under src/api/generated. - Hand-written apiClient and wrappers in src/api (base URL from VITE_API_BASE_URL / dev default). - Biome excludes generated output; document .env.example and OpenAPI scripts in apps/web README. - Wire openapi:validate to pnpm --filter @solid-pact/openapi run lint. - Mark PLAN §4.2 complete. Made-with: Cursor
There was a problem hiding this comment.
Pull request overview
Adds a generated fetch-based OpenAPI SDK to the SolidJS web app (PLAN §4.2), along with a small hand-written client/wrapper layer and OpenAPI validation wiring.
Changes:
- Generate and commit a full SDK under
apps/web/src/api/generated/via@hey-api/openapi-ts. - Add
apiClientwithVITE_API_BASE_URL/dev-default base URL resolution plus wrapper exports inapps/web/src/api/. - Wire scripts/docs/config for generation + Redocly lint (
openapi:generate,openapi:validate) and exclude generated code from Biome.
Reviewed changes
Copilot reviewed 9 out of 27 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Adds @hey-api/openapi-ts and related transitive dependencies. |
| PLAN.md | Marks PLAN §4.2 as complete. |
| apps/web/tsconfig.node.json | Includes openapi-ts.config.ts in node TS config for tooling/typechecking. |
| apps/web/src/vite-env.d.ts | Adds VITE_API_BASE_URL typing for Vite env. |
| apps/web/src/api/index.ts | Exposes apiClient plus typed wrappers for SDK endpoints. |
| apps/web/src/api/generated/types.gen.ts | Generated API types from the OpenAPI spec. |
| apps/web/src/api/generated/sdk.gen.ts | Generated endpoint functions using the generated fetch client. |
| apps/web/src/api/generated/index.ts | Generated barrel exports for the generated SDK/types. |
| apps/web/src/api/generated/core/utils.gen.ts | Generated URL/path/body utilities used by the client. |
| apps/web/src/api/generated/core/types.gen.ts | Generated core client/type utilities. |
| apps/web/src/api/generated/core/serverSentEvents.gen.ts | Generated SSE client implementation (core). |
| apps/web/src/api/generated/core/queryKeySerializer.gen.ts | Generated query-key serialization helpers. |
| apps/web/src/api/generated/core/pathSerializer.gen.ts | Generated parameter serialization logic for paths/queries. |
| apps/web/src/api/generated/core/params.gen.ts | Generated argument-to-request-params mapping utilities. |
| apps/web/src/api/generated/core/bodySerializer.gen.ts | Generated body + query serializer implementations. |
| apps/web/src/api/generated/core/auth.gen.ts | Generated auth token helpers. |
| apps/web/src/api/generated/client/utils.gen.ts | Generated fetch-client helpers (config, headers, auth, interceptors). |
| apps/web/src/api/generated/client/types.gen.ts | Generated fetch-client types. |
| apps/web/src/api/generated/client/index.ts | Generated exports for the fetch-client layer. |
| apps/web/src/api/generated/client/client.gen.ts | Generated fetch client implementation. |
| apps/web/src/api/generated/client.gen.ts | Generated default client instance (currently hardcoded baseUrl). |
| apps/web/src/api/client.ts | Hand-written apiClient with env/dev/same-origin base URL resolution. |
| apps/web/README.md | Documents OpenAPI client generation/validation usage for the web app. |
| apps/web/package.json | Adds OpenAPI generate/validate scripts and devDependency on @hey-api/openapi-ts. |
| apps/web/openapi-ts.config.ts | Configures OpenAPI input/output for SDK generation. |
| apps/web/biome.json | Excludes generated SDK directory from Biome checks. |
| apps/web/.env.example | Documents VITE_API_BASE_URL usage and defaults. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Addresses Copilot: import ClientOptions from the generated fetch client so baseUrl stays a plain string (same-origin and env) without OpenAPI literal casts. Made-with: Cursor
- Set REDOCLY_TELEMETRY=off so Redocly does not run npm -v for telemetry (pnpm passes npm_config_* keys npm warns about). - Set REDOCLY_SUPPRESS_UPDATE_NOTICE=true for cleaner output. - Use cross-env so the lint script works on Windows. Made-with: Cursor
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.
Summary
Completes PLAN §4.2: generate a full fetch-based SDK from
packages/openapi/openapi.yamlusing@hey-api/openapi-ts, with hand-writtenapiClient+ wrappers inapps/web/src/api/, and Redocly lint wired forpnpm openapi:validate.Details
apps/web/src/api/generated/(committed; regenerate viapnpm --filter web openapi:generate).VITE_API_BASE_URLoptional; dev defaults tohttp://127.0.0.1:8000; production build uses same-origin when unset (seeapps/web/.env.example).apps/webopenapi:validatedelegates topnpm --filter @solid-pact/openapi run lint(redocly lint).Checklist
pnpm --filter web lintpnpm --filter web testpnpm --filter web buildpnpm --filter web openapi:validateMade with Cursor