Commit 599a9ba3 authored by canterafonsj's avatar canterafonsj
Browse files

Fix common schema

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