From 5bac2eefe55262698bb9cb4c3724d09dcf96e370 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Gomez?= Date: Thu, 8 Feb 2024 23:14:02 +0100 Subject: [PATCH] Extract comments --- cmd/generate-jsonschema/main.go | 5 +++++ schemas/dashboard.json | 12 ++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/cmd/generate-jsonschema/main.go b/cmd/generate-jsonschema/main.go index 29f72d5b..6a690c66 100644 --- a/cmd/generate-jsonschema/main.go +++ b/cmd/generate-jsonschema/main.go @@ -35,6 +35,11 @@ func main() { return key }, } + + if err := reflector.AddGoComments("github.com/K-Phoen/grabana", "./decoder"); err != nil { + panic(fmt.Errorf("could not add Go comments to reflector: %w", err)) + } + schema := reflector.Reflect(t.input) schema.ID = jsonschema.ID(fmt.Sprintf("https://raw.githubusercontent.com/K-Phoen/grabana/master/schemas/%s.json", t.name)) diff --git a/schemas/dashboard.json b/schemas/dashboard.json index af7c5d6d..cc767958 100644 --- a/schemas/dashboard.json +++ b/schemas/dashboard.json @@ -66,7 +66,8 @@ "type": "string" }, "avg": { - "type": "string" + "type": "string", + "description": "Query reducers, only one should be used" }, "sum": { "type": "string" @@ -437,7 +438,8 @@ } }, "additionalProperties": false, - "type": "object" + "type": "object", + "description": "DashboardHeatmap represents a heatmap panel." }, "DashboardInternalLink": { "properties": { @@ -655,7 +657,8 @@ } }, "additionalProperties": false, - "type": "object" + "type": "object", + "description": "DashboardRow represents a dashboard row." }, "DashboardSingleStat": { "properties": { @@ -863,7 +866,8 @@ } }, "additionalProperties": false, - "type": "object" + "type": "object", + "description": "DashboardTable represents a table panel." }, "DashboardText": { "properties": {