grafana / cog

Code Generation with a human touch
Apache License 2.0
43 stars 2 forks source link

Language/php ci psalm #482

Closed K-Phoen closed 3 months ago

K-Phoen commented 3 months ago

Psalm and PHPStan use two different type inference algorithms, and as such can complement each other in the reports they produce. For safety, let's run both.

Contributes to #470

github-actions[bot] commented 3 months ago

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` ```patch diff --git a/jsonschema/azuremonitor.jsonschema.json b/jsonschema/azuremonitor.jsonschema.json index 983c6d1..7a9da51 100644 --- a/jsonschema/azuremonitor.jsonschema.json +++ b/jsonschema/azuremonitor.jsonschema.json @@ -1,5 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", + "$ref": "#/definitions/AzureMonitorQuery", "definitions": { "AzureMonitorQuery": { "type": "object", diff --git a/jsonschema/cloudwatch.jsonschema.json b/jsonschema/cloudwatch.jsonschema.json index 996b5ee..e8cd42e 100644 --- a/jsonschema/cloudwatch.jsonschema.json +++ b/jsonschema/cloudwatch.jsonschema.json @@ -1,5 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", + "$ref": "#/definitions/CloudWatchQuery", "definitions": { "MetricStat": { "type": "object", diff --git a/jsonschema/elasticsearch.jsonschema.json b/jsonschema/elasticsearch.jsonschema.json index f80edcc..08b5c6f 100644 --- a/jsonschema/elasticsearch.jsonschema.json +++ b/jsonschema/elasticsearch.jsonschema.json @@ -1,5 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", + "$ref": "#/definitions/dataquery", "definitions": { "BucketAggregation": { "anyOf": [ diff --git a/jsonschema/googlecloudmonitoring.jsonschema.json b/jsonschema/googlecloudmonitoring.jsonschema.json index c129a4b..8693f61 100644 --- a/jsonschema/googlecloudmonitoring.jsonschema.json +++ b/jsonschema/googlecloudmonitoring.jsonschema.json @@ -1,5 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", + "$ref": "#/definitions/CloudMonitoringQuery", "definitions": { "CloudMonitoringQuery": { "type": "object", diff --git a/jsonschema/grafanapyroscope.jsonschema.json b/jsonschema/grafanapyroscope.jsonschema.json index d16c059..80c67c0 100644 --- a/jsonschema/grafanapyroscope.jsonschema.json +++ b/jsonschema/grafanapyroscope.jsonschema.json @@ -1,5 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", + "$ref": "#/definitions/dataquery", "definitions": { "PyroscopeQueryType": { "enum": [ diff --git a/jsonschema/loki.jsonschema.json b/jsonschema/loki.jsonschema.json index 9b5e7d4..c9d5185 100644 --- a/jsonschema/loki.jsonschema.json +++ b/jsonschema/loki.jsonschema.json @@ -1,5 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", + "$ref": "#/definitions/dataquery", "definitions": { "QueryEditorMode": { "enum": [ diff --git a/jsonschema/parca.jsonschema.json b/jsonschema/parca.jsonschema.json index c1235f5..6901bf8 100644 --- a/jsonschema/parca.jsonschema.json +++ b/jsonschema/parca.jsonschema.json @@ -1,5 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", + "$ref": "#/definitions/dataquery", "definitions": { "ParcaQueryType": { "enum": [ diff --git a/jsonschema/prometheus.jsonschema.json b/jsonschema/prometheus.jsonschema.json index cd6e9ce..fde9f58 100644 --- a/jsonschema/prometheus.jsonschema.json +++ b/jsonschema/prometheus.jsonschema.json @@ -1,5 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", + "$ref": "#/definitions/dataquery", "definitions": { "QueryEditorMode": { "enum": [ diff --git a/jsonschema/tempo.jsonschema.json b/jsonschema/tempo.jsonschema.json index de1fabf..744d96e 100644 --- a/jsonschema/tempo.jsonschema.json +++ b/jsonschema/tempo.jsonschema.json @@ -1,5 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", + "$ref": "#/definitions/TempoQuery", "definitions": { "TempoQuery": { "type": "object", diff --git a/jsonschema/testdata.jsonschema.json b/jsonschema/testdata.jsonschema.json index 61a92bf..66fdf2c 100644 --- a/jsonschema/testdata.jsonschema.json +++ b/jsonschema/testdata.jsonschema.json @@ -1,5 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", + "$ref": "#/definitions/testdata", "definitions": { "CSVWave": { "type": "object", diff --git a/python/grafana_foundation_sdk/cog/plugins.py b/python/grafana_foundation_sdk/cog/plugins.py index 1a2e2d0..8ec6611 100644 --- a/python/grafana_foundation_sdk/cog/plugins.py +++ b/python/grafana_foundation_sdk/cog/plugins.py @@ -1,39 +1,39 @@ # Code generated - EDITING IS FUTILE. DO NOT EDIT. -from ..models import googlecloudmonitoring -from ..models import nodegraph -from ..models import tempo -from ..models import text -from ..models import cloudwatch -from ..models import dashboardlist -from ..models import parca from ..models import table -from ..models import barchart from ..models import statushistory -from ..models import timeseries -from ..models import stat -from ..models import gauge +from ..models import datagrid +from ..models import loki +from ..models import parca +from ..models import statetimeline +from ..models import tempo +from ..models import geomap from ..models import heatmap -from ..models import xychart -from ..models import azuremonitor +from ..models import candlestick +from ..models import canvas +from ..models import gauge +from ..models import googlecloudmonitoring +from ..models import stat from ..models import annotationslist -from ..models import bargauge +from ..models import barchart +from ..models import nodegraph from ..models import elasticsearch -from ..models import geomap +from ..models import dashboardlist +from ..models import debug +from ..models import xychart +from ..models import prometheus +from ..models import bargauge +from ..models import cloudwatch from ..models import histogram from ..models import logs -from ..models import candlestick -from ..models import grafanapyroscope -from ..models import news from ..models import piechart -from ..models import expr -from ..models import datagrid -from ..models import debug -from ..models import loki -from ..models import statetimeline +from ..models import text +from ..models import azuremonitor from ..models import trend -from ..models import prometheus -from ..models import canvas +from ..models import expr +from ..models import grafanapyroscope +from ..models import news +from ..models import timeseries from . import runtime as cogruntime diff --git a/python/grafana_foundation_sdk/models/cloudwatch.py b/python/grafana_foundation_sdk/models/cloudwatch.py index 68ad69b..fac0fa9 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[QueryEditorFunctionExpression], typing.Type[QueryEditorPropertyExpression]]] = {"function": QueryEditorFunctionExpression, "property": QueryEditorPropertyExpression} + decoding_map: dict[str, typing.Union[typing.Type[QueryEditorPropertyExpression], typing.Type[QueryEditorFunctionExpression]]] = {"property": QueryEditorPropertyExpression, "function": QueryEditorFunctionExpression} 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 bcd9dbf..6e1a9ac 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[TypeReduce], typing.Type[TypeResample], typing.Type[TypeClassicConditions], typing.Type[TypeThreshold], typing.Type[TypeSql], typing.Type[TypeMath]]] = {"reduce": TypeReduce, "resample": TypeResample, "classic_conditions": TypeClassicConditions, "threshold": TypeThreshold, "sql": TypeSql, "math": TypeMath} + 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} return cogruntime.DataqueryConfig( identifier="__expr__", from_json_hook=lambda data: decoding_map[data["type"]].from_json(data), diff --git a/python/grafana_foundation_sdk/models/rolebinding.py b/python/grafana_foundation_sdk/models/rolebinding.py index e8f302c..eafa911 100644 --- a/python/grafana_foundation_sdk/models/rolebinding.py +++ b/python/grafana_foundation_sdk/models/rolebinding.py @@ -25,7 +25,7 @@ class RoleBinding: args: dict[str, typing.Any] = {} if "role" in data: - decoding_map: dict[str, typing.Union[typing.Type[BuiltinRoleRef], typing.Type[CustomRoleRef]]] = {"BuiltinRole": BuiltinRoleRef, "Role": CustomRoleRef} + decoding_map: dict[str, typing.Union[typing.Type[CustomRoleRef], typing.Type[BuiltinRoleRef]]] = {"Role": CustomRoleRef, "BuiltinRole": BuiltinRoleRef} args["role"] = decoding_map[data["role"]["kind"]].from_json(data["role"]) if "subject" in data: args["subject"] = RoleBindingSubject.from_json(data["subject"]) diff --git a/python/pyproject.toml b/python/pyproject.toml index 6382073..cfe392c 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -13,7 +13,7 @@ keywords = [ "traces", "metrics" ] -version = "1719238427!next" +version = "1719256769!next" dependencies = [] requires-python = ">=3.11" classifiers = [ diff --git a/typescript/package.json b/typescript/package.json index 20699cd..7174540 100644 --- a/typescript/package.json +++ b/typescript/package.json @@ -1,6 +1,6 @@ { "name": "@grafana/grafana-foundation-sdk", - "version": "next-cogv0.0.x.1719238427", + "version": "next-cogv0.0.x.1719256769", "description": "A set of tools, types and libraries for building and manipulating Grafana objects.", "keywords": [ "observability", ```