Skip to content

FEATURE BRANCH: Add v2beta1 api version: Consolidate schema breaking changes #108172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 32 commits into
base: main
Choose a base branch
from

Conversation

@dprokop dprokop added no-backport Skip backport of PR no-changelog Skip including change in changelog/release notes labels Jul 17, 2025
@dprokop dprokop changed the title Schemav2 bring back reverts Consolidate Breaking changes from DS refactor through app platform conversion Jul 17, 2025
@ivanortegaalba ivanortegaalba changed the title Consolidate Breaking changes from DS refactor through app platform conversion Add v2alpha2 api version: Consolidate schema breaking changes Jul 17, 2025
ivanortegaalba and others added 4 commits July 17, 2025 12:17
* Use v2alpha2 by default

* Apply only DS changes to alpha2

* Use v2alpha2 by default except to query

* Create a v2 index in @grafana/schema

* Update path and apply lint

* Update tests
@dprokop dprokop added no-changelog Skip including change in changelog/release notes and removed no-changelog Skip including change in changelog/release notes labels Jul 17, 2025
@dprokop dprokop marked this pull request as ready for review July 17, 2025 14:17
@dprokop dprokop requested review from a team as code owners July 17, 2025 14:17
@dprokop dprokop requested review from axelavargas and juanicabanas and removed request for a team July 17, 2025 14:17
@ivanortegaalba ivanortegaalba requested a review from Copilot July 25, 2025 11:13
Copilot

This comment was marked as outdated.

Copy link
Contributor

@ivanortegaalba ivanortegaalba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double checked, it looks great! I'd love the eyes of @stephaniehingtgen from the backend point of view, but looks great so far 💯

@ivanortegaalba ivanortegaalba requested a review from a team as a code owner July 28, 2025 15:15
@ivanortegaalba ivanortegaalba requested review from alexanderzobnin, mihai-turdean and Copilot and removed request for a team July 28, 2025 15:15
Copilot

This comment was marked as outdated.

@ivanortegaalba ivanortegaalba requested a review from Copilot July 28, 2025 15:23
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR consolidates schema breaking changes by introducing a new v2beta1 API version to replace the experimental v2alpha1 version. The changes include updating imports, API version references, and data structure modifications throughout the codebase.

Key changes:

  • Migration from v2alpha1 to v2beta1 API version across the entire codebase
  • Updates to data query structure to use a more standardized format with DataQuery kind and separate group field
  • Refactoring of datasource references in queries, variables, and annotations

Reviewed Changes

Copilot reviewed 144 out of 148 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Frontend imports Updated all schema imports from v2alpha1 to v2 simplified path
API version constants Changed API version from v2alpha1 to v2beta1
Data structures Modified query structures to use new DataQuery format with separate group and datasource fields
Test files Updated test data and assertions to match new schema
Backend Go files Updated imports and API version references from v2alpha2 to v2beta1
Comments suppressed due to low confidence (1)

@@ -332,43 +333,43 @@ export function getFolderByUid(uid: string): Promise<{ uid: string; title: strin
}

export async function processV2DatasourceInput(
obj: PanelQueryKind['spec'] | QueryVariableKind['spec'] | AnnotationQueryKind['spec'],
spec: PanelQueryKind['spec'] | QueryVariableKind['spec'] | AnnotationQueryKind['spec'],
inputs: Record<string, DataSourceInput> = {}
) {
Copy link
Preview

Copilot AI Jul 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential null reference error: spec.query could be undefined, which would cause a runtime error when accessing spec.query.datasource. Consider adding a null check before accessing nested properties.

Suggested change
) {
) {
if (!spec.query) {
return inputs; // If spec.query is undefined, return inputs as-is
}

Copilot uses AI. Check for mistakes.

Comment on lines +339 to +341
const datasourceRef = spec.query.datasource;
let dataSourceInput: DataSourceInput | undefined;
const dsType = spec.query.group;
Copy link
Preview

Copilot AI Jul 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential null reference error: spec.query could be undefined, which would cause a runtime error when accessing spec.query.group. This should be protected with the same null check as the datasourceRef.

Suggested change
const datasourceRef = spec.query.datasource;
let dataSourceInput: DataSourceInput | undefined;
const dsType = spec.query.group;
const datasourceRef = spec.query?.datasource;
let dataSourceInput: DataSourceInput | undefined;
const dsType = spec.query?.group;

Copilot uses AI. Check for mistakes.

@ivanortegaalba
Copy link
Contributor

@harisrozajac feel free to merge if everything is ok!

@harisrozajac
Copy link
Contributor

@ivanortegaalba should we wait for app platform's input?

@stephaniehingtgen stephaniehingtgen changed the title FEATURE BRANCH: Add v2alpha2 api version: Consolidate schema breaking changes FEATURE BRANCH: Add v2beta1 api version: Consolidate schema breaking changes Jul 28, 2025
Copy link
Contributor

@stephaniehingtgen stephaniehingtgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall - one small change & one question

@@ -7,4 +7,4 @@
// because grafana-app-sdk already provides deepcopy functions.
// Kinds which are not generated by the SDK are explicitly opted in to deepcopy generation.

package v2alpha2 // import "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1"
package v2beta1 // import "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
package v2beta1 // import "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1"
package v2beta1 // import "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2beta1"

Comment on lines +854 to +855
// For brevity, assume the structure is identical and just return nil
// In a real implementation, this would need proper conversion
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like this needs to be implemented?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consolidate Breaking changes from DS refactor through app platform conversion
4 participants