Schema v2: Remove schemaVersion property (#99375)

* Schema v2: Remove schemaVersion property

* ah snap
This commit is contained in:
Dominik Prokop
2025-01-22 16:52:34 +01:00
committed by GitHub
parent 88ab29f6ba
commit daced46d27
9 changed files with 3 additions and 18 deletions
@@ -49,9 +49,6 @@ DashboardV2Spec: {
layout: GridLayoutKind
// Version of the JSON schema, incremented each time a Grafana update brings
// changes to said schema.
schemaVersion: uint16 | *39
// Plugins only. The version of the dashboard installed together with the plugin.
// This is used to determine if the dashboard should be updated when the plugin is updated.
@@ -8,7 +8,6 @@ export const handyTestingSchema: DashboardV2Spec = {
liveNow: false,
preload: false,
editable: true,
schemaVersion: 40,
tags: ['tag1', 'tag2'],
timeSettings: {
autoRefresh: '5s',
@@ -34,9 +34,6 @@ export interface DashboardV2Spec {
elements: Record<string, Element>;
annotations: AnnotationQueryKind[];
layout: GridLayoutKind;
// Version of the JSON schema, incremented each time a Grafana update brings
// changes to said schema.
schemaVersion: number;
// Plugins only. The version of the dashboard installed together with the plugin.
// This is used to determine if the dashboard should be updated when the plugin is updated.
revision?: number;
@@ -54,7 +51,6 @@ export const defaultDashboardV2Spec = (): DashboardV2Spec => ({
elements: {},
annotations: [],
layout: defaultGridLayoutKind(),
schemaVersion: 39,
});
// Supported dashboard elements
@@ -682,7 +682,6 @@ function setupV2(spec?: Partial<DashboardV2Spec>) {
spec: {
...defaultDashboardV2Spec(),
title: 'hello',
schemaVersion: 30,
timeSettings: {
...defaultTimeSettingsSpec(),
autoRefresh: '10s',
@@ -179,7 +179,7 @@ export class V2DashboardSerializer
if (this.initialSaveModel) {
return {
schemaVersion: this.initialSaveModel.schemaVersion,
schemaVersion: 40,
uid: s.state.uid,
title: this.initialSaveModel.title,
panels_count: panelPluginIds.length || 0,
@@ -126,7 +126,6 @@ exports[`transformSceneToSaveModelSchemaV2 should transform scene to save model
],
"liveNow": true,
"preload": true,
"schemaVersion": 40,
"tags": [
"tag1",
"tag2",
@@ -11,7 +11,6 @@ import {
VizPanel,
} from '@grafana/scenes';
import { DataSourceRef } from '@grafana/schema';
import { DASHBOARD_SCHEMA_VERSION } from 'app/features/dashboard/state/DashboardMigrator';
import {
DashboardV2Spec,
@@ -83,7 +82,6 @@ export function transformSceneToSaveModelSchemaV2(scene: DashboardScene, isSnaps
editable: oldDash.editable,
links: oldDash.links,
tags: oldDash.tags,
schemaVersion: DASHBOARD_SCHEMA_VERSION,
// EOF dashboard settings
// time settings
@@ -367,7 +367,6 @@ describe('ResponseTransformers', () => {
expect(spec.title).toBe(dashboardV1.title);
expect(spec.description).toBe(dashboardV1.description);
expect(spec.tags).toEqual(dashboardV1.tags);
expect(spec.schemaVersion).toBe(dashboardV1.schemaVersion);
expect(spec.cursorSync).toBe('Off'); // Assuming transformCursorSynctoEnum(0) returns 'Off'
expect(spec.preload).toBe(dashboardV1.preload);
expect(spec.liveNow).toBe(dashboardV1.liveNow);
@@ -516,7 +515,6 @@ describe('ResponseTransformers', () => {
title: 'Dashboard Title',
description: 'Dashboard Description',
tags: ['tag1', 'tag2'],
schemaVersion: 1,
cursorSync: 'Off',
preload: true,
liveNow: false,
@@ -596,7 +594,7 @@ describe('ResponseTransformers', () => {
expect(dashboard.title).toBe(dashboardV2.spec.title);
expect(dashboard.description).toBe(dashboardV2.spec.description);
expect(dashboard.tags).toEqual(dashboardV2.spec.tags);
expect(dashboard.schemaVersion).toBe(dashboardV2.spec.schemaVersion);
expect(dashboard.schemaVersion).toBe(40);
// expect(dashboard.graphTooltip).toBe(0); // Assuming transformCursorSynctoEnum('Off') returns 0
expect(dashboard.preload).toBe(dashboardV2.spec.preload);
expect(dashboard.liveNow).toBe(dashboardV2.spec.liveNow);
@@ -117,7 +117,6 @@ export function ensureV2Response(
title: dashboard.title,
description: dashboard.description,
tags: dashboard.tags ?? [],
schemaVersion: dashboard.schemaVersion,
cursorSync: transformCursorSynctoEnum(dashboard.graphTooltip),
preload: dashboard.preload || dashboardDefaults.preload,
liveNow: dashboard.liveNow,
@@ -202,7 +201,7 @@ export function ensureV1Response(
title: spec.title,
description: spec.description,
tags: spec.tags,
schemaVersion: spec.schemaVersion,
schemaVersion: 40,
graphTooltip: transformCursorSyncV2ToV1(spec.cursorSync),
preload: spec.preload,
liveNow: spec.liveNow,