From 6cfb897398734f721f0d7e646a291342ad2112db Mon Sep 17 00:00:00 2001
From: Jose Manuel Cantera <josemanuel.cantera@fiware.org>
Date: Tue, 20 Nov 2018 13:54:50 +0100
Subject: [PATCH] Entity now is a definition

---
 schema/Entity.json | 107 +++++++++++++++++++++++++--------------------
 1 file changed, 60 insertions(+), 47 deletions(-)

diff --git a/schema/Entity.json b/schema/Entity.json
index 492b652..6e2339e 100644
--- a/schema/Entity.json
+++ b/schema/Entity.json
@@ -20,7 +20,13 @@
           "const": "Property"
         },
         "value": {
-          "type": ["string","number","boolean","array","object"]
+          "type": [
+            "string",
+            "number",
+            "boolean",
+            "array",
+            "object"
+          ]
         },
         "observedAt": {
           "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/observedAt"
@@ -135,55 +141,62 @@
           }
         ]
       }
-    }
-  },
-  "type": "object",
-  "properties": {
-    "id": {
-      "type": "string",
-      "format": "uri"
-    },
-    "type": {
-      "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/Name"
-    },
-    "@context": {
-      "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/LdContext"
     },
-    "location": {
-      "$ref": "#/definitions/GeoProperty"
-    },
-    "observationSpace": {
-      "$ref": "#/definitions/GeoProperty"
-    },
-    "operationSpace": {
-      "$ref": "#/definitions/GeoProperty"
-    },
-    "createdAt": {
-      "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/createdAt"
-    },
-    "modifiedAt": {
-      "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/modifiedAt"
-    }
-  },
-  "required": [
-    "id",
-    "type"
-  ],
-  "additionalProperties": {
-    "anyOf": [
-      {
-        "$ref": "#/definitions/Property"
+    "Entity": {
+      "type": "object",
+      "properties": {
+        "id": {
+          "type": "string",
+          "format": "uri"
+        },
+        "type": {
+          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/Name"
+        },
+        "@context": {
+          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/LdContext"
+        },
+        "location": {
+          "$ref": "#/definitions/GeoProperty"
+        },
+        "observationSpace": {
+          "$ref": "#/definitions/GeoProperty"
+        },
+        "operationSpace": {
+          "$ref": "#/definitions/GeoProperty"
+        },
+        "createdAt": {
+          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/createdAt"
+        },
+        "modifiedAt": {
+          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/modifiedAt"
+        }
       },
-      {
-        "$ref": "#/definitions/Relationship"
+      "required": [
+        "id",
+        "type"
+      ],
+      "additionalProperties": {
+        "anyOf": [
+          {
+            "$ref": "#/definitions/Property"
+          },
+          {
+            "$ref": "#/definitions/Relationship"
+          },
+          {
+            "$ref": "#/definitions/GeoProperty"
+          }
+        ]
       },
+      "propertyNames": {
+        "type": "string",
+        "pattern": "^((\\d|[a-zA-Z]|_)+(#\\d+)?)$|^(@context)$"
+      }
+    }
+  },
+    "allOf": [
       {
-        "$ref": "#/definitions/GeoProperty"
+        "$ref": "#/definitions/Entity"
       }
     ]
-  },
-  "propertyNames": {
-    "type": "string",
-    "pattern": "^((\\d|[a-zA-Z]|_)+(#\\d+)?)$|^(@context)$"
-  }
-}
+}
\ No newline at end of file
-- 
GitLab