Commit 88f28fba authored by canterafonsj's avatar canterafonsj
Browse files

Restoring Subscriptions

parent 31ba1cf5
Loading
Loading
Loading
Loading
+171 −148
Original line number Diff line number Diff line
{
  "$schema": "http://json-schema.org/schema#",
	"id": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/subscriptions/Subscription.json",
	"title": "NGSI-LD Common Definitions",
	"description": "NGSI-LD Common",
  "id": "https://uri.etsi.org/ngsi-ld/schema/Subscription.json",
  "title": "NGSI-LD Subscription",
  "description": "NGSI-LD Subscription",
  "definitions": {
		"Name": {
    "NotificationParams": {
      "type": "object",
      "properties": {
        "attributes": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
			"pattern": "^(\\d|[a-zA-Z]|_)+$",
			"minLength": 1,
			"description": "NGSI-LD Name"
            "minLength": 1
          },
		"observedAt": {
			"type": "string",
			"format": "date-time"
          "uniqueItems": true
        },
		"createdAt": {
			"type": "string",
			"format": "date-time"
        "format": {
          "type": "string"
        },
		"modifiedAt": {
        "endpoint": {
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/Endpoint"
        },
        "status": {
          "type": "string",
			"format": "date-time"
          "enum": [
            "ok",
            "failed"
          ]
        },
		"LdContext": {
			"anyOf": [{
					"type": "object"
        "timesSent": {
          "type": "number",
          "minimum": 1
        },
				{
        "lastNotification": {
          "type": "string",
					"format": "uri"
          "format": "date-time"
        },
				{
					"type": "array",
					"minItems": 1,
					"items": {
						"anyOf": [{
        "lastFailure": {
          "type": "string",
								"format": "uri"
          "format": "date-time"
        },
							{
								"type": "object"
							}
						]
					}
        "lastSuccess": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "endpoint"
      ]
    },
		"Endpoint": {
    "GeoQuery": {
      "type": "object",
      "required": [
				"uri"
        "geometry",
        "coordinates",
        "georel"
      ],
      "properties": {
				"uri": {
					"type": "string",
					"format": "uri"
        "georel": {
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/georel"
        },
				"accept": {
					"type": "string",
					"enum": [
						"application/json",
						"application/ld+json"
					]
        "coordinates": {
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/coordinates"
        },
        "geometry": {
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/geometry"
        }
      }
    }
  },
		"EntityInfo": {
  "type": "object",
  "properties": {
    "id": {
@@ -73,78 +77,97 @@
      "format": "uri"
    },
    "type": {
					"$ref": "#/definitions/Name"
				},
				"idPattern": {
      "type": "string",
					"format": "regex"
				}
      "const": "Subscription"
    },
			"required": [
				"type"
			]
    "@context": {
      "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/LdContext"
    },
		"ProblemDetails": {
			"type": "object",
			"properties": {
				"type": {
    "entities": {
      "type": "array",
      "items": {
        "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/EntityInfo"
      },
      "minItems": 1
    },
    "name": {
      "type": "string",
					"format": "uri"
      "minLength": 1
    },
				"title": {
					"type": "string"
    "description": {
      "type": "string",
      "minLength": 1
    },
				"detail": {
					"type": "string"
				}
    "notification": {
      "$ref": "#/definitions/NotificationParams"
    },
			"required": [
				"type"
			]
    "watchedAttributes": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/Name"
      },
		"georel": {
			"anyOf": [{
      "uniqueItems": true
    },
    "timeInterval": {
      "type": "number",
      "minimum": 0
    },
    "expires": {
      "type": "string",
      "format": "date-time"
    },
    "status": {
      "type": "string",
      "enum": [
						"equals",
						"disjoint",
						"intersects",
						"within",
						"contains",
						"overlaps"
        "active",
        "paused",
        "expired"
      ]
    },
				{
					"type": "string",
					"pattern": "^near;((maxDistance==\\d+)|(minDistance==\\d+))$"
    "isActive": {
      "type": "boolean"
    },
    "throttling": {
      "type": "number",
      "minimum": 1
    },
    "q": {
      "type": "string"
    },
    "geoQ": {
      "$ref": "#/definitions/GeoQuery"  
    },
    "csf": {
      "type": "string"
    }
			]
  },
		"coordinates": {
			"oneOf": [{
					"$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/geometry-schema.json#/definitions/position"
  "createdAt": {
    "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/createdAt"
  },
				{
					"$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/geometry-schema.json#/definitions/positionArray"
  "modifiedAt": {
    "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/modifiedAt"
  },
  "allOf": [
    {
					"$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/geometry-schema.json#/definitions/lineString"
      "required": [
        "id",
        "type"
      ]
    },
    {
					"$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/geometry-schema.json#/definitions/polygon"
				}
      "anyOf": [
        {
          "required": [
            "entities"
          ]
        },
		"geometry": {
			"type": "string",
			"enumeration": [
				"Point",
				"MultiPoint",
				"LineString",
				"MultiLineString",
				"Polygon",
				"MultiPolygon"
        {
          "required": [
            "watchedAttributes"
          ]
        }
      ]
    }
  ]
}