From 482cbfddcf9b9843d7d2ae3aaa157497f9512204 Mon Sep 17 00:00:00 2001
From: Sergio Moya <1083296+smoya@users.noreply.github.com>
Date: Wed, 13 Jul 2022 13:03:21 +0200
Subject: [PATCH] feat: add schema listing all Schema-Store JSON Schema docs
 (#237)

---
 schemas/all.schema-store.json | 149 ++++++++++++++++++++++++++++++++++
 test/index.js                 |   3 +-
 2 files changed, 151 insertions(+), 1 deletion(-)
 create mode 100644 schemas/all.schema-store.json

diff --git a/schemas/all.schema-store.json b/schemas/all.schema-store.json
new file mode 100644
index 00000000..27f71a2b
--- /dev/null
+++ b/schemas/all.schema-store.json
@@ -0,0 +1,149 @@
+{
+  "$id": "http://asyncapi.com/schema-store/all.schema-store.json",
+  "$schema": "http://json-schema.org/draft-07/schema",
+  "title": "JSON Schema documents for all AsyncAPI spec versions",
+  "description": "All AsyncAPI JSON Schema documents listed in one file. Needed for serving all documents through schemastore.org",
+  "type": "object",
+  "oneOf": [
+    {
+      "allOf": [
+        {
+          "properties": {
+            "asyncapi": {
+              "const": "1.0.0"
+            }
+          }
+        },
+        {
+          "$ref": "http://asyncapi.com/schema-store/1.0.0.json"
+        }
+      ]
+    },
+    {
+      "allOf": [
+        {
+          "properties": {
+            "asyncapi": {
+              "const": "1.1.0"
+            }
+          }
+        },
+        {
+          "$ref": "http://asyncapi.com/schema-store/1.1.0.json"
+        }
+      ]
+    },
+    {
+      "allOf": [
+        {
+          "properties": {
+            "asyncapi": {
+              "const": "1.2.0"
+            }
+          }
+        },
+        {
+          "$ref": "http://asyncapi.com/schema-store/1.2.0.json"
+        }
+      ]
+    },
+    {
+      "allOf": [
+        {
+          "properties": {
+            "asyncapi": {
+              "const": "2.0.0-rc1"
+            }
+          }
+        },
+        {
+          "$ref": "http://asyncapi.com/schema-store/2.0.0-rc1.json"
+        }
+      ]
+    },
+    {
+      "allOf": [
+        {
+          "properties": {
+            "asyncapi": {
+              "const": "2.0.0-rc2"
+            }
+          }
+        },
+        {
+          "$ref": "http://asyncapi.com/schema-store/2.0.0-rc2.json"
+        }
+      ]
+    },
+    {
+      "allOf": [
+        {
+          "properties": {
+            "asyncapi": {
+              "const": "2.0.0"
+            }
+          }
+        },
+        {
+          "$ref": "http://asyncapi.com/schema-store/2.0.0.json"
+        }
+      ]
+    },
+    {
+      "allOf": [
+        {
+          "properties": {
+            "asyncapi": {
+              "const": "2.1.0"
+            }
+          }
+        },
+        {
+          "$ref": "http://asyncapi.com/schema-store/2.1.0.json"
+        }
+      ]
+    },
+    {
+      "allOf": [
+        {
+          "properties": {
+            "asyncapi": {
+              "const": "2.2.0"
+            }
+          }
+        },
+        {
+          "$ref": "http://asyncapi.com/schema-store/2.2.0.json"
+        }
+      ]
+    },
+    {
+      "allOf": [
+        {
+          "properties": {
+            "asyncapi": {
+              "const": "2.3.0"
+            }
+          }
+        },
+        {
+          "$ref": "http://asyncapi.com/schema-store/2.3.0.json"
+        }
+      ]
+    },
+    {
+      "allOf": [
+        {
+          "properties": {
+            "asyncapi": {
+              "const": "2.4.0"
+            }
+          }
+        },
+        {
+          "$ref": "http://asyncapi.com/schema-store/2.4.0.json"
+        }
+      ]
+    }
+  ]
+}
\ No newline at end of file
diff --git a/test/index.js b/test/index.js
index 8fd5b237..af2b4ad3 100644
--- a/test/index.js
+++ b/test/index.js
@@ -9,10 +9,11 @@ describe('AsyncAPI', () => {
   });
 
   it('should check if json schema is exported and if it matches the original file', () => {
+    const skipFiles = ["README", "all.schema-store"];
     const files = fs.readdirSync('schemas');
     files.forEach(file => {
       const fileName = path.parse(file).name;
-      if (fileName == "README") return;
+      if (skipFiles.includes(fileName)) return;
 
       const asyncapi = require('..');
       assert(typeof asyncapi[fileName] === 'object', `Returned object does not contain ${fileName}.`);