From dcfde495c7ec32c3875b612905b4be16eb73e82e Mon Sep 17 00:00:00 2001
From: Sebastian Frank <sebastian@webmakers.de>
Date: Fri, 18 Nov 2022 16:26:45 +0000
Subject: [PATCH] assets in schema

---
 demo-api/config.yml            |  6 +++++-
 schemas/api-config/assets.json | 23 +++++++++++++++++++++++
 schemas/api-config/config.json | 15 +++++++++++++++
 3 files changed, 43 insertions(+), 1 deletion(-)
 create mode 100644 schemas/api-config/assets.json

diff --git a/demo-api/config.yml b/demo-api/config.yml
index 8f564ff..189f09b 100644
--- a/demo-api/config.yml
+++ b/demo-api/config.yml
@@ -7,4 +7,8 @@ meta:
 
 # Liste aller möglichen Kollektionen (Listen, Seiten...) zum Projekt
 collections:
-    - !include collections/mycol.yml
\ No newline at end of file
+    - !include collections/mycol.yml
+
+assets:
+    - name: _dist_
+      path: ../frontend/_dist_
diff --git a/schemas/api-config/assets.json b/schemas/api-config/assets.json
new file mode 100644
index 0000000..dc88afa
--- /dev/null
+++ b/schemas/api-config/assets.json
@@ -0,0 +1,23 @@
+{
+    "$schema": "http://json-schema.org/draft-07/schema#",
+    "title": "JSON Schema tibi-server assets configuration",
+    "description": "tibi-server assets linter",
+    "type": "object",
+    "additionalProperties": false,
+    "patternProperties": {
+        "^x\\-": {
+            "description": "template property"
+        }
+    },
+    "properties": {
+        "name": {
+            "type": "string",
+            "description": "name, used in url ../NAMESPACE/_/assets/NAME"
+        },
+        "path": {
+            "type": "string",
+            "description": "path relative to config.yml"
+        }
+    },
+    "required": ["name", "path"]
+}
diff --git a/schemas/api-config/config.json b/schemas/api-config/config.json
index 7422427..8c32c5e 100644
--- a/schemas/api-config/config.json
+++ b/schemas/api-config/config.json
@@ -54,6 +54,21 @@
                     }
                 ]
             }
+        },
+        "assets": {
+            "type": "array",
+            "description": "list of assets in this project",
+            "items": {
+                "oneOf": [
+                    {
+                        "$comment": "for include tag",
+                        "type": "string"
+                    },
+                    {
+                        "$ref": "assets.json"
+                    }
+                ]
+            }
         }
     },
     "required": ["namespace"]