mirror of
https://github.com/grafana/grafana.git
synced 2025-09-21 04:12:52 +08:00
Alerting: Package 📦 (#102899)
This commit is contained in:
21
packages/grafana-alerting/scripts/codegen.ts
Normal file
21
packages/grafana-alerting/scripts/codegen.ts
Normal file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* This script will generate TypeScript type definitions and a RTKQ client for the alerting k8s APIs.
|
||||
* It downloads the OpenAPI schema from a running Grafana instance and generates the types.
|
||||
*
|
||||
* Run `yarn run codegen` from the "grafana-alerting" package to invoke this script.
|
||||
*/
|
||||
import { type ConfigFile } from '@rtk-query/codegen-openapi';
|
||||
import { resolve } from 'node:path';
|
||||
|
||||
// these snapshots are generated by running "go test pkg/tests/apis/openapi_test.go", see the README in the "openapi_snapshots" directory
|
||||
const OPENAPI_SCHEMA_LOCATION = resolve(
|
||||
'../../../pkg/tests/apis/openapi_snapshots/notifications.alerting.grafana.app-v0alpha1.json'
|
||||
);
|
||||
|
||||
export default {
|
||||
exportName: 'alertingAPI',
|
||||
schemaFile: OPENAPI_SCHEMA_LOCATION,
|
||||
apiFile: '../src/grafana/api.ts',
|
||||
outputFile: resolve('../src/grafana/api.gen.ts'),
|
||||
tag: true,
|
||||
} satisfies ConfigFile;
|
Reference in New Issue
Block a user