grafana/grafana
@grafana/api-clients and @grafana/openapi
Two related packages that handle OpenAPI → TypeScript code generation.
@grafana/openapi (packages/grafana-openapi/)
Tooling and templates for generating clients from the merged Grafana OpenAPI spec (public/api-merged.json). The package exposes scripts that:
- Read the merged OpenAPI spec.
- Run
openapi-generator(or a similar tool) with Grafana's customizations. - Emit RTK Query slices into
@grafana/api-clients.
Run via:
yarn generate:openapi@grafana/api-clients (packages/grafana-api-clients/)
The output of the generator. Each Kubernetes-style API group / version produces its own slice. Consumers (public/app, plugins) import the generated hooks like any other RTK Query API:
import { useGetDashboardQuery } from '@grafana/api-clients/dashboard/v0alpha1';When you change a Go handler's Swagger annotations or a CUE-defined resource:
make swagger-genregeneratespublic/api-merged.json.yarn generate-apisregenerates@grafana/api-clients/src/api/*.gen.ts.- Commit the regenerated files alongside the source change.
See also
- Backend / API layer — Swagger annotations.
- Backend / unified storage — k8s-style endpoints these clients target.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.