{"id":21721373,"url":"https://github.com/informaticsmatters/squonk2-openapi-js-client-generator","last_synced_at":"2026-05-08T07:31:52.836Z","repository":{"id":61546841,"uuid":"421821913","full_name":"InformaticsMatters/squonk2-openapi-js-client-generator","owner":"InformaticsMatters","description":"TypeScript client generator for OpenAPI files. GitHub Action to generate, build \u0026 publish a client with docs!","archived":false,"fork":false,"pushed_at":"2026-04-29T09:56:38.000Z","size":582,"stargazers_count":1,"open_issues_count":14,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-29T11:27:32.786Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/InformaticsMatters.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-10-27T13:06:33.000Z","updated_at":"2025-12-05T16:13:35.000Z","dependencies_parsed_at":"2026-02-19T19:03:01.416Z","dependency_job_id":null,"html_url":"https://github.com/InformaticsMatters/squonk2-openapi-js-client-generator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/InformaticsMatters/squonk2-openapi-js-client-generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InformaticsMatters%2Fsquonk2-openapi-js-client-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InformaticsMatters%2Fsquonk2-openapi-js-client-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InformaticsMatters%2Fsquonk2-openapi-js-client-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InformaticsMatters%2Fsquonk2-openapi-js-client-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/InformaticsMatters","download_url":"https://codeload.github.com/InformaticsMatters/squonk2-openapi-js-client-generator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InformaticsMatters%2Fsquonk2-openapi-js-client-generator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32770987,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T02:36:36.067Z","status":"ssl_error","status_checked_at":"2026-05-08T02:36:07.210Z","response_time":54,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-26T02:16:10.796Z","updated_at":"2026-05-08T07:31:52.829Z","avatar_url":"https://github.com/InformaticsMatters.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Action to Generate and Publish a TS Client \u0026 Docs from an OpenAPI File\n\n## Generator\n\nGenerate a React / TypeScript client from an OpenAPI file. [Orval](https://orval.dev) is used to generate a client from the tagged OpenAPI file. This is fully typed and provides functions to make API calls along with [@tanstack/react-query](https://tanstack.com/query) hooks for queries and mutations. Axios is used to make HTTP calls.\n\nThe `operationId`s can be replaced with more useful names by specifying an `x-semantic-name` field alongside the `operationId`. These no longer need to be globally unique (like the operationId does) but still need to be unique within a `tag` to avoid name clashes.\n\n## Build\n\nThe source client is built using [tsdown](https://tsdown.dev). Both CommonJS and ESM outputs are provided. To allow efficient tree-shaking and bundling, each `tag` from the OpenAPI file is provided in its own submodule as its own entry-point.\n\n## Query Key Prefixing\n\nTo prevent cache collisions when multiple API clients are used in the same application, query keys are automatically prefixed with the API name. This is handled by a post-processing script (`morph-query-keys.ts`) that runs after code generation. The prefix is extracted from the package name (e.g., `@squonk/account-server-client` → `\"account-server\"`).\n\n## Package Structure\n\n### Primary entry-point `@org/service-client`:\n\n- The `customInstance` used to make calls is exported for cases where the generated API doesn't provide certain features.\n- All TypeScript types generated from the OpenAPI spec are exported from here. Import types separately using `import type {} from '@squonk/service-client'`.\n\n### Sub-entry points (e.g., `@squonk/service-client/accounting`):\n\nEach OpenAPI tag is available as a submodule, exporting:\n\n- **Query hooks**: `use{OperationName}` (e.g., `useGetAccountServerNamespace`) with prefixed query keys\n- **Suspense query hooks**: `use{OperationName}SuspenseQuery` for use with React `\u003cSuspense\u003e` boundaries\n- **Mutation hooks**: `use{OperationName}` for POST/PUT/DELETE operations\n- **Query key helpers**: `get{OperationName}QueryKey()` returns the prefixed query key used by the hook (e.g., `[\"account-server\", \"getAccountServerNamespace\"]`)\n- **Invalidate helpers**: `useInvalidate{OperationName}()` returns a function to invalidate the query cache\n\nOperation names come from the `x-semantic-name` fields specified in the OpenAPI spec.\n\n## Current Clients\n\n- [Data Manager Client](https://www.npmjs.com/package/@squonk/data-manager-client)\n- [Account Server Client](https://www.npmjs.com/package/@squonk/account-server-client)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finformaticsmatters%2Fsquonk2-openapi-js-client-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finformaticsmatters%2Fsquonk2-openapi-js-client-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finformaticsmatters%2Fsquonk2-openapi-js-client-generator/lists"}