From bf8c38897f7fbd9d6c71188a050b89ee5ef88079 Mon Sep 17 00:00:00 2001
From: Fotis Voutsas <fotis@netdata.cloud>
Date: Thu, 13 Jul 2023 20:55:20 +0300
Subject: [PATCH] Updates on JSON schemas (#15382)

---
 collectors/metadata/schemas/definitions.json  | 40 +++----------------
 .../metadata/schemas/single-module.json       |  7 +++-
 .../metadata/single-module-template.yaml      | 18 +++------
 docs/.templates/integration/schema.json       | 21 +++-------
 4 files changed, 21 insertions(+), 65 deletions(-)

diff --git a/collectors/metadata/schemas/definitions.json b/collectors/metadata/schemas/definitions.json
index 3ee24c600b..0b7412767e 100644
--- a/collectors/metadata/schemas/definitions.json
+++ b/collectors/metadata/schemas/definitions.json
@@ -19,51 +19,21 @@
             "$ref": "#/definitions/category"
           }
         },
-        "icon_path": {
+        "icon_filename": {
           "type": "string",
-          "description": "Path to the integration's icon."
+          "description": "The filename of the integration's icon, as sourced from https://github.com/netdata/website/tree/master/themes/tailwind/static/img."
         }
       },
       "required": [
         "name",
         "link",
         "categories",
-        "icon_path"
+        "icon_filename"
       ]
     },
     "category": {
-      "type": "object",
-      "description": "Category and subcategory of the collector/monitored instance.",
-      "properties": {
-        "level0": {
-          "type": "string",
-          "description": "Category name",
-          "oneOf": [
-            {
-              "enum": [
-                "data-collection"
-              ]
-            }
-          ]
-        },
-        "level1": {
-          "type": "string",
-          "description": "Subcategory name",
-          "oneOf": [
-            {
-              "enum": [
-                "most-popular",
-                "databases",
-                "web-servers",
-                "message-brokers",
-                "hardware-and-sensors",
-                "operating-systems",
-                "containers-and-vms"
-              ]
-            }
-          ]
-        }
-      }
+      "type": "string",
+      "description": "String defining integration category"
     },
     "alerts": {
       "type": "array",
diff --git a/collectors/metadata/schemas/single-module.json b/collectors/metadata/schemas/single-module.json
index f469ee79cf..7299cbdd8b 100644
--- a/collectors/metadata/schemas/single-module.json
+++ b/collectors/metadata/schemas/single-module.json
@@ -81,6 +81,10 @@
           "required": [
             "description"
           ]
+        },
+        "most_popular": {
+          "type": "boolean",
+          "description": "Whether or not the integration is to be flagged as most-popular, meaning it will show up at the top of the menu."
         }
       },
       "required": [
@@ -90,7 +94,8 @@
         "alternative_monitored_instances",
         "keywords",
         "related_resources",
-        "info_provided_to_referring_integrations"
+        "info_provided_to_referring_integrations",
+        "most_popular"
       ]
     },
     "overview": {
diff --git a/collectors/metadata/single-module-template.yaml b/collectors/metadata/single-module-template.yaml
index d03128c6b7..54f3ceaf1a 100644
--- a/collectors/metadata/single-module-template.yaml
+++ b/collectors/metadata/single-module-template.yaml
@@ -1,20 +1,12 @@
 meta:
   plugin_name: ""
   module_name: ""
+  alternative_monitored_instances: []
   monitored_instance:
     name: ""
     link: ""
-    icon_path: ""
-    categories:
-      - level0: data-collection
-        level1: databases
-  alternative_monitored_instances:
-    - name: ""
-      link: ""
-      icon_path: ""
-      categories:
-        - level0: data-collection
-          level1: containers-and-vms
+    categories: []
+    icon_filename: ""
   related_resources:
     integrations:
       list:
@@ -22,8 +14,8 @@ meta:
           module_name: ""
   info_provided_to_referring_integrations:
     description: ""
-  keywords:
-    - ""
+  keywords: []
+  most_popular: false
 overview:
   data_collection:
     metrics_description: ""
diff --git a/docs/.templates/integration/schema.json b/docs/.templates/integration/schema.json
index f4a5e96d2e..1e2ce85337 100644
--- a/docs/.templates/integration/schema.json
+++ b/docs/.templates/integration/schema.json
@@ -17,17 +17,6 @@
                                 "type": "string",
                                 "description": "Name of the category. This is the actual name of the category or subcategory, (e.g. Web Servers, Operating Systems, Databases)."
                             },
-                            "limit_results": {
-                                "type": [
-                                    "null",
-                                    "integer"
-                                ],
-                                "description": "A value that if set to an integer will limit the amount of subitems that this category will display. Additional subcategories will be hidden behind a `Show more` field."
-                            },
-                            "icon_name": {
-                                "type": "string",
-                                "description": "The name of the icon from the Netdata UI."
-                            },
                             "description": {
                                 "type": "string",
                                 "description": "Text that will be presented below the category title."
@@ -37,13 +26,13 @@
                                 "description": "Priority of the category. A number expressing where the category should be in the menu. The smaller the number the higher the priority, so a category with priority 1 would be above a category with a priority of 50 in terms of menu ordering."
                             },
                             "id": {
-                                "type": "integer",
+                                "type": "string",
                                 "description": "ID of the category that will be used by integrations, this is a unique number for each category that will be used by its children to refer to it as their parent."
                             },
                             "parent_id": {
                                 "type": [
                                     "null",
-                                    "integer"
+                                    "string"
                                 ],
                                 "description": "The category's parent ID. If this category is a subcategory, then it needs to mention its parent, where it belongs to. Make it null if no parent and this is a top level category."
                             }
@@ -59,8 +48,8 @@
                 "type": "object",
                 "properties": {
                     "id": {
-                        "type": "integer",
-                        "description": "A unique numeric identifier for the integration."
+                        "type": "string",
+                        "description": "A unique string identifier for the integration."
                     },
                     "name": {
                         "type": "string"
@@ -72,7 +61,7 @@
                             "type": "object",
                             "properties": {
                                 "category_id": {
-                                    "type": "integer",
+                                    "type": "string",
                                     "description": "The category_ID for this integration."
                                 },
                                 "priority": {