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

Fix common schema

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