diff --git a/pkg/plugins/codegen/jenny_plugingotypes.go b/pkg/plugins/codegen/jenny_plugingotypes.go index cc34c610352..c631b8f0598 100644 --- a/pkg/plugins/codegen/jenny_plugingotypes.go +++ b/pkg/plugins/codegen/jenny_plugingotypes.go @@ -41,6 +41,7 @@ func (j *pgoJenny) Generate(decl *pfs.PluginDecl) (*codejen.File, error) { Group: decl.SchemaInterface.IsGroup(), Config: &copenapi.Config{ ExpandReferences: true, + MaxCycleDepth: 10, }, }, PackageName: slotname, diff --git a/pkg/tsdb/cloudwatch/kinds/dataquery/types_dataquery_gen.go b/pkg/tsdb/cloudwatch/kinds/dataquery/types_dataquery_gen.go index afd937176e8..0c7df705400 100644 --- a/pkg/tsdb/cloudwatch/kinds/dataquery/types_dataquery_gen.go +++ b/pkg/tsdb/cloudwatch/kinds/dataquery/types_dataquery_gen.go @@ -143,6 +143,16 @@ const ( QueryEditorArrayExpressionTypeOr QueryEditorArrayExpressionType = "or" ) +// Defines values for QueryEditorExpressionExpressionsParametersType. +const ( + QueryEditorExpressionExpressionsParametersTypeFunctionParameter QueryEditorExpressionExpressionsParametersType = "functionParameter" +) + +// Defines values for QueryEditorExpressionExpressionsPropertyType. +const ( + QueryEditorExpressionExpressionsPropertyTypeString QueryEditorExpressionExpressionsPropertyType = "string" +) + // Defines values for QueryEditorExpressionParametersType. const ( QueryEditorExpressionParametersTypeFunctionParameter QueryEditorExpressionParametersType = "functionParameter" @@ -475,7 +485,8 @@ type CloudWatchMetricsQuerySqlGroupByExpressionsPropertyType string // CloudWatchMetricsQuerySqlGroupByExpressionsItem defines model for CloudWatchMetricsQuery.sql.groupBy.expressions.Item. type CloudWatchMetricsQuerySqlGroupByExpressionsItem struct { - Name *string `json:"name,omitempty"` + Expressions []interface{} `json:"expressions,omitempty"` + Name *string `json:"name,omitempty"` // TS type is operator: QueryEditorOperator, extended in veneer Operator *struct { @@ -517,7 +528,8 @@ type CloudWatchMetricsQuerySqlWhereExpressionsPropertyType string // CloudWatchMetricsQuerySqlWhereExpressionsItem defines model for CloudWatchMetricsQuery.sql.where.expressions.Item. type CloudWatchMetricsQuerySqlWhereExpressionsItem struct { - Name *string `json:"name,omitempty"` + Expressions []interface{} `json:"expressions,omitempty"` + Name *string `json:"name,omitempty"` // TS type is operator: QueryEditorOperator, extended in veneer Operator *struct { @@ -588,7 +600,8 @@ type QueryEditorArrayExpressionExpressionsPropertyType string // QueryEditorArrayExpressionExpressionsItem defines model for QueryEditorArrayExpression.expressions.Item. type QueryEditorArrayExpressionExpressionsItem struct { - Name *string `json:"name,omitempty"` + Expressions []interface{} `json:"expressions,omitempty"` + Name *string `json:"name,omitempty"` // TS type is operator: QueryEditorOperator, extended in veneer Operator *struct { @@ -610,9 +623,10 @@ type QueryEditorArrayExpressionExpressionsItem struct { // QueryEditorArrayExpressionType defines model for QueryEditorArrayExpression.Type. type QueryEditorArrayExpressionType string -// QueryEditorArrayExpression is added in veneer +// QueryEditorExpression defines model for QueryEditorExpression. type QueryEditorExpression struct { - Name *string `json:"name,omitempty"` + Expressions []QueryEditorExpressionExpressionsItem `json:"expressions,omitempty"` + Name *string `json:"name,omitempty"` // TS type is operator: QueryEditorOperator, extended in veneer Operator *struct { @@ -631,6 +645,33 @@ type QueryEditorExpression struct { union json.RawMessage } +// QueryEditorExpressionExpressionsParametersType defines model for QueryEditorExpression.Expressions.Parameters.Type. +type QueryEditorExpressionExpressionsParametersType string + +// QueryEditorExpressionExpressionsPropertyType defines model for QueryEditorExpression.Expressions.Property.Type. +type QueryEditorExpressionExpressionsPropertyType string + +// QueryEditorExpressionExpressionsItem defines model for QueryEditorExpression.expressions.Item. +type QueryEditorExpressionExpressionsItem struct { + Name *string `json:"name,omitempty"` + + // TS type is operator: QueryEditorOperator, extended in veneer + Operator *struct { + Name *string `json:"name,omitempty"` + Value *interface{} `json:"value,omitempty"` + } `json:"operator,omitempty"` + Parameters []struct { + Name *string `json:"name,omitempty"` + Type QueryEditorExpressionExpressionsParametersType `json:"type"` + } `json:"parameters,omitempty"` + Property *struct { + Name *string `json:"name,omitempty"` + Type QueryEditorExpressionExpressionsPropertyType `json:"type"` + } `json:"property,omitempty"` + Type *interface{} `json:"type,omitempty"` + union json.RawMessage +} + // QueryEditorExpressionParametersType defines model for QueryEditorExpression.Parameters.Type. type QueryEditorExpressionParametersType string @@ -790,7 +831,8 @@ type SQLExpressionGroupByExpressionsPropertyType string // SQLExpressionGroupByExpressionsItem defines model for SQLExpression.GroupBy.Expressions.Item. type SQLExpressionGroupByExpressionsItem struct { - Name *string `json:"name,omitempty"` + Expressions []interface{} `json:"expressions,omitempty"` + Name *string `json:"name,omitempty"` // TS type is operator: QueryEditorOperator, extended in veneer Operator *struct { @@ -832,7 +874,8 @@ type SQLExpressionWhereExpressionsPropertyType string // SQLExpressionWhereExpressionsItem defines model for SQLExpression.Where.Expressions.Item. type SQLExpressionWhereExpressionsItem struct { - Name *string `json:"name,omitempty"` + Expressions []interface{} `json:"expressions,omitempty"` + Name *string `json:"name,omitempty"` // TS type is operator: QueryEditorOperator, extended in veneer Operator *struct { diff --git a/public/app/plugins/datasource/cloudwatch/__mocks__/sqlUtils.ts b/public/app/plugins/datasource/cloudwatch/__mocks__/sqlUtils.ts index 70a8e358eff..f593d43f4e4 100644 --- a/public/app/plugins/datasource/cloudwatch/__mocks__/sqlUtils.ts +++ b/public/app/plugins/datasource/cloudwatch/__mocks__/sqlUtils.ts @@ -14,12 +14,12 @@ export function createArray( expressions: QueryEditorExpression[], type: QueryEditorExpressionType.And | QueryEditorExpressionType.Or = QueryEditorExpressionType.And ) { - const array = { + const array: QueryEditorArrayExpression = { type, expressions, }; - return array as QueryEditorArrayExpression; + return array; } export function createOperator(property: string, operator: string, value?: string): QueryEditorOperatorExpression { diff --git a/public/app/plugins/datasource/cloudwatch/dataquery.cue b/public/app/plugins/datasource/cloudwatch/dataquery.cue index b6c7ce5c646..c6addead9d8 100644 --- a/public/app/plugins/datasource/cloudwatch/dataquery.cue +++ b/public/app/plugins/datasource/cloudwatch/dataquery.cue @@ -125,8 +125,7 @@ composableKinds: DataQuery: { expressions: [...#QueryEditorExpression] | [...#QueryEditorArrayExpression] } @cuetsy(kind="interface") - // QueryEditorArrayExpression is added in veneer - #QueryEditorExpression: #QueryEditorPropertyExpression | #QueryEditorGroupByExpression | #QueryEditorFunctionExpression | #QueryEditorFunctionParameterExpression | #QueryEditorOperatorExpression @cuetsy(kind="type") + #QueryEditorExpression: #QueryEditorArrayExpression | #QueryEditorPropertyExpression | #QueryEditorGroupByExpression | #QueryEditorFunctionExpression | #QueryEditorFunctionParameterExpression | #QueryEditorOperatorExpression @cuetsy(kind="type") #CloudWatchLogsQuery: { common.DataQuery diff --git a/public/app/plugins/datasource/cloudwatch/dataquery.gen.ts b/public/app/plugins/datasource/cloudwatch/dataquery.gen.ts index 2f87b0bf4f5..eb31858f06b 100644 --- a/public/app/plugins/datasource/cloudwatch/dataquery.gen.ts +++ b/public/app/plugins/datasource/cloudwatch/dataquery.gen.ts @@ -143,10 +143,7 @@ export interface QueryEditorArrayExpression { type: (QueryEditorExpressionType.And | QueryEditorExpressionType.Or); } -/** - * QueryEditorArrayExpression is added in veneer - */ -export type QueryEditorExpression = (QueryEditorPropertyExpression | QueryEditorGroupByExpression | QueryEditorFunctionExpression | QueryEditorFunctionParameterExpression | QueryEditorOperatorExpression); +export type QueryEditorExpression = (QueryEditorArrayExpression | QueryEditorPropertyExpression | QueryEditorGroupByExpression | QueryEditorFunctionExpression | QueryEditorFunctionParameterExpression | QueryEditorOperatorExpression); export interface CloudWatchLogsQuery extends common.DataQuery { expression?: string; diff --git a/public/app/plugins/datasource/cloudwatch/expressions.ts b/public/app/plugins/datasource/cloudwatch/expressions.ts index a8e13f8fd8a..a7dce622813 100644 --- a/public/app/plugins/datasource/cloudwatch/expressions.ts +++ b/public/app/plugins/datasource/cloudwatch/expressions.ts @@ -2,9 +2,6 @@ import { QueryEditorOperatorExpression as QueryEditorOperatorExpressionBase, QueryEditorOperator as QueryEditorOperatorBase, QueryEditorOperatorValueType, - QueryEditorExpressionType, - QueryEditorExpression as QueryEditorExpressionBase, - QueryEditorArrayExpression, } from './dataquery.gen'; export { QueryEditorPropertyType, @@ -14,10 +11,10 @@ export { QueryEditorFunctionExpression, QueryEditorFunctionParameterExpression, QueryEditorArrayExpression, + QueryEditorExpressionType, + QueryEditorExpression, } from './dataquery.gen'; -export { QueryEditorExpressionType }; - export interface QueryEditorOperator extends QueryEditorOperatorBase { value?: T; } @@ -25,5 +22,3 @@ export interface QueryEditorOperator ext export interface QueryEditorOperatorExpression extends QueryEditorOperatorExpressionBase { operator: QueryEditorOperator; } - -export type QueryEditorExpression = QueryEditorArrayExpression | QueryEditorExpressionBase;