-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
base: main
Are you sure you want to change the base?
Conversation
v2alpha2
api version: Consolidate schema breaking changes
* 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
apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.ds-data-query.v2alpha2.json
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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 💯
…everts # Conflicts: # go.work.sum
There was a problem hiding this 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
tov2beta1
API version across the entire codebase - Updates to data query structure to use a more standardized format with
DataQuery
kind and separategroup
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> = {} | |||
) { |
There was a problem hiding this comment.
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.
) { | |
) { | |
if (!spec.query) { | |
return inputs; // If spec.query is undefined, return inputs as-is | |
} |
Copilot uses AI. Check for mistakes.
const datasourceRef = spec.query.datasource; | ||
let dataSourceInput: DataSourceInput | undefined; | ||
const dsType = spec.query.group; |
There was a problem hiding this comment.
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.
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.
public/app/features/dashboard-scene/serialization/transformSceneToSaveModelSchemaV2.ts
Show resolved
Hide resolved
@harisrozajac feel free to merge if everything is ok! |
@ivanortegaalba should we wait for app platform's input? |
v2alpha2
api version: Consolidate schema breaking changes v2beta1
api version: Consolidate schema breaking changes
There was a problem hiding this 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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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" |
// For brevity, assume the structure is identical and just return nil | ||
// In a real implementation, this would need proper conversion |
There was a problem hiding this comment.
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?
Includes:
Fixes #108127