cog icon indicating copy to clipboard operation
cog copied to clipboard

fix(inputs): get metadata from config

Open Duologic opened this issue 1 year ago • 1 comments

I was relying on this metadata to include the right schema into Grafonnet. This PR fetches the metadata in the main config.

Duologic avatar May 22 '24 20:05 Duologic

Note: in addition to the changes introduced by this PR, the diff includes unreleased changes living in main.

🔎 Changes to grafana-foundation-sdk@next+cog-v0.0.x

diff --git a/openapi/testdata.openapi.json b/openapi/testdata.openapi.json
index 1cf10b9..ac9ed8e 100644
--- a/openapi/testdata.openapi.json
+++ b/openapi/testdata.openapi.json
@@ -4,7 +4,8 @@
     "title": "testdata",
     "version": "0.0.0",
     "x-schema-identifier": "",
-    "x-schema-kind": ""
+    "x-schema-kind": "composable",
+    "x-schema-variant": "dataquery"
   },
   "paths": {},
   "components": {
diff --git a/python/grafana_foundation_sdk/cog/plugins.py b/python/grafana_foundation_sdk/cog/plugins.py
index b2cec56..73e0313 100644
--- a/python/grafana_foundation_sdk/cog/plugins.py
+++ b/python/grafana_foundation_sdk/cog/plugins.py
@@ -1,38 +1,38 @@
 # Code generated - EDITING IS FUTILE. DO NOT EDIT.
 
-from ..models import azuremonitor
+from ..models import nodegraph
 from ..models import parca
-from ..models import xychart
-from ..models import news
-from ..models import annotationslist
+from ..models import azuremonitor
+from ..models import barchart
 from ..models import datagrid
-from ..models import geomap
-from ..models import googlecloudmonitoring
-from ..models import grafanapyroscope
-from ..models import nodegraph
-from ..models import cloudwatch
+from ..models import loki
+from ..models import elasticsearch
 from ..models import logs
-from ..models import trend
 from ..models import statetimeline
+from ..models import trend
+from ..models import prometheus
+from ..models import news
+from ..models import table
+from ..models import xychart
+from ..models import cloudwatch
 from ..models import statushistory
-from ..models import bargauge
-from ..models import candlestick
-from ..models import dashboardlist
-from ..models import elasticsearch
-from ..models import stat
 from ..models import text
-from ..models import canvas
-from ..models import debug
+from ..models import timeseries
+from ..models import bargauge
+from ..models import geomap
 from ..models import histogram
-from ..models import prometheus
-from ..models import barchart
 from ..models import gauge
-from ..models import piechart
+from ..models import annotationslist
+from ..models import canvas
+from ..models import debug
+from ..models import grafanapyroscope
 from ..models import heatmap
-from ..models import loki
-from ..models import table
 from ..models import tempo
-from ..models import timeseries
+from ..models import stat
+from ..models import candlestick
+from ..models import dashboardlist
+from ..models import googlecloudmonitoring
+from ..models import piechart
 from . import runtime as cogruntime
 
 
diff --git a/python/grafana_foundation_sdk/models/cloudwatch.py b/python/grafana_foundation_sdk/models/cloudwatch.py
index 761fcb8..8ef9b81 100644
--- a/python/grafana_foundation_sdk/models/cloudwatch.py
+++ b/python/grafana_foundation_sdk/models/cloudwatch.py
@@ -332,7 +332,7 @@ class SQLExpression:
         if "select" in data:
             args["select"] = QueryEditorFunctionExpression.from_json(data["select"])
         if "from" in data:
-            decoding_map: dict[str, typing.Union[typing.Type[QueryEditorPropertyExpression], typing.Type[QueryEditorFunctionExpression]]] = {"property": QueryEditorPropertyExpression, "function": QueryEditorFunctionExpression}
+            decoding_map: dict[str, typing.Union[typing.Type[QueryEditorFunctionExpression], typing.Type[QueryEditorPropertyExpression]]] = {"function": QueryEditorFunctionExpression, "property": QueryEditorPropertyExpression}
             args["from_val"] = decoding_map[data["from"]["type"]].from_json(data["from"])
         if "where" in data:
             args["where"] = QueryEditorArrayExpression.from_json(data["where"])
@@ -894,7 +894,7 @@ CloudWatchQuery: typing.TypeAlias = typing.Union['CloudWatchMetricsQuery', 'Clou
 
 
 def variant_config() -> cogruntime.DataqueryConfig:
-    decoding_map: dict[str, typing.Union[typing.Type[CloudWatchMetricsQuery], typing.Type[CloudWatchLogsQuery], typing.Type[CloudWatchAnnotationQuery]]] = {"Metrics": CloudWatchMetricsQuery, "Logs": CloudWatchLogsQuery, "Annotations": CloudWatchAnnotationQuery}
+    decoding_map: dict[str, typing.Union[typing.Type[CloudWatchAnnotationQuery], typing.Type[CloudWatchMetricsQuery], typing.Type[CloudWatchLogsQuery]]] = {"Annotations": CloudWatchAnnotationQuery, "Metrics": CloudWatchMetricsQuery, "Logs": CloudWatchLogsQuery}
     return cogruntime.DataqueryConfig(
         identifier="cloudwatch",
         from_json_hook=lambda data: decoding_map[data["queryMode"]].from_json(data),
diff --git a/python/grafana_foundation_sdk/models/expr.py b/python/grafana_foundation_sdk/models/expr.py
index ea417d3..e2af171 100644
--- a/python/grafana_foundation_sdk/models/expr.py
+++ b/python/grafana_foundation_sdk/models/expr.py
@@ -9,7 +9,7 @@ Expr: typing.TypeAlias = typing.Union['TypeMath', 'TypeReduce', 'TypeResample',
 
 
 def variant_config() -> cogruntime.DataqueryConfig:
-    decoding_map: dict[str, typing.Union[typing.Type[TypeThreshold], typing.Type[TypeSql], typing.Type[TypeMath], typing.Type[TypeReduce], typing.Type[TypeResample], typing.Type[TypeClassicConditions]]] = {"threshold": TypeThreshold, "sql": TypeSql, "math": TypeMath, "reduce": TypeReduce, "resample": TypeResample, "classic_conditions": TypeClassicConditions}
+    decoding_map: dict[str, typing.Union[typing.Type[TypeClassicConditions], typing.Type[TypeThreshold], typing.Type[TypeSql], typing.Type[TypeMath], typing.Type[TypeReduce], typing.Type[TypeResample]]] = {"classic_conditions": TypeClassicConditions, "threshold": TypeThreshold, "sql": TypeSql, "math": TypeMath, "reduce": TypeReduce, "resample": TypeResample}
     return cogruntime.DataqueryConfig(
         identifier="__expr__",
         from_json_hook=lambda data: decoding_map[data["type"]].from_json(data),
diff --git a/python/pyproject.toml b/python/pyproject.toml
index 6610f18..bab8c5f 100644
--- a/python/pyproject.toml
+++ b/python/pyproject.toml
@@ -13,7 +13,7 @@ keywords = [
     "traces",
     "metrics"
 ]
-version = "1716368518!next"
+version = "1716410805!next"
 dependencies = []
 requires-python = ">=3.11"
 classifiers = [
diff --git a/typescript/package.json b/typescript/package.json
index e9ad580..3d55000 100644
--- a/typescript/package.json
+++ b/typescript/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@grafana/grafana-foundation-sdk",
-  "version": "next-cogv0.0.x.1716368518",
+  "version": "next-cogv0.0.x.1716410805",
   "description": "A set of tools, types and libraries for building and manipulating Grafana objects.",
   "keywords": [
     "observability",

github-actions[bot] avatar May 22 '24 20:05 github-actions[bot]