packages/grafana-api-clients/src/generator/README.md
This generator automates the process of creating RTK Query API clients for Grafana's API groups. It replaces the manual steps outlined in the main API documentation.
yarn generate:api-client
The CLI will prompt for:
dashboard)<group-name>.grafana.app)v0alpha1)<group-name>API). This will also be used as the API's named export.createDashboard,updateDashboard). If not provided, all endpoints will be included.The generator automates the following:
baseAPI.ts file for the API groupscripts/generate-rtk-apis.ts for OSS APIslocal/generate-enterprise-apis.ts for Enterprise APIsindex.ts file with proper exportsrtkq.tspackage.json exports to include the new API clientopenapi_snapshots directoryIf an error about a missing OpenAPI schema appears, check that:
TestIntegrationOpenAPIs test has been run to generate the schema (step 1 in the main API documentation).packages/grafana-openapi/src/apis/<group>-<version>.json.grafana.appv0alpha1, v1beta2, etc.API