Commit c4f887f1 authored by canterafonsj's avatar canterafonsj
Browse files

Subscriptions OAS first stab

parent bb5216fd
[
{
"id": "urn:ngsi-ld:Subscription:mySubscription",
"type": "Subscription",
"entities": [
{
"type": "Vehicle"
}
],
"watchedAttributes": [
"speed"
],
"q": "speed>50",
"geoQ": {
"georel": "near;maxDistance==2000",
"geometry": "Point",
"coordinates": [
-1,
100
]
},
"notification": {
"attributes": [
"speed"
],
"format": "keyValues",
"endpoint": {
"uri": "http://my.endpoint.org/notify",
"accept": "application/json"
}
},
"@context": [
"https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/coreContext/ngsi-ld-core-context.json",
"http://example.org/cim/vehicle.jsonld"
]
}
]
......@@ -68,106 +68,125 @@
"$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/geometry"
}
}
}
},
"type": "object",
"properties": {
"id": {
"type": "string",
"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
},
"name": {
"type": "string",
"minLength": 1
},
"description": {
"type": "string",
"minLength": 1
},
"notification": {
"$ref": "#/definitions/NotificationParams"
},
"watchedAttributes": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/Name"
},
"uniqueItems": true
},
"timeInterval": {
"type": "number",
"minimum": 0
},
"expires": {
"type": "string",
"format": "date-time"
},
"status": {
"type": "string",
"enum": [
"active",
"paused",
"expired"
]
},
"isActive": {
"type": "boolean"
},
"throttling": {
"type": "number",
"minimum": 1
},
"q": {
"type": "string"
},
"geoQ": {
"$ref": "#/definitions/GeoQuery"
},
"csf": {
"type": "string"
}
},
"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"
},
"allOf": [
{
"required": [
"id",
"type"
]
"SubscriptionFragment": {
"type": "object",
"properties": {
"@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": {
"type": "string",
"minLength": 1
},
"description": {
"type": "string",
"minLength": 1
},
"watchedAttributes": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/Name"
},
"uniqueItems": true
},
"timeInterval": {
"type": "number",
"minimum": 0
},
"expires": {
"type": "string",
"format": "date-time"
},
"isActive": {
"type": "boolean"
},
"throttling": {
"type": "number",
"minimum": 1
},
"q": {
"type": "string"
},
"geoQ": {
"$ref": "#/definitions/GeoQuery"
},
"csf": {
"type": "string"
}
}
},
{
"anyOf": [
"Subscription": {
"allOf": [
{
"required": [
"entities"
]
"$ref": "#/definitions/SubscriptionFragment"
},
{
"required": [
"watchedAttributes"
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uri"
},
"type": {
"type": "string",
"const": "Subscription"
},
"notification": {
"$ref": "#/definitions/NotificationParams"
},
"status": {
"type": "string",
"enum": [
"active",
"paused",
"expired"
]
},
"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"
}
},
"allOf": [
{
"required": [
"id",
"type"
]
},
{
"anyOf": [
{
"required": [
"entities"
]
},
{
"required": [
"watchedAttributes"
]
}
]
}
]
}
]
}
},
"allOf": [
{
"$ref": "#/definitions/Subscription"
}
]
}
{
"$schema": "http://json-schema.org/schema#",
"id": "https://uri.etsi.org/ngsi-ld/schema/SubscriptionList.json",
"title": "NGSI-LD Subscription List",
"description": "NGSI-LD Subscription List",
"definitions": {
"SubscriptionList": {
"type": "array",
"items": {
"$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/Subscription.json#/definitions/Subscription"
}
}
},
"allOf": [{
"$ref": "#/definitions/SubscriptionList"
}]
}
......@@ -152,16 +152,16 @@
"schema": {
"oneOf": [
{
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/GeoProperty/properties/value/definitions/position"
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/properties/location/properties/value/definitions/position"
},
{
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/GeoProperty/properties/value/definitions/positionArray"
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/properties/location/properties/value/definitions/positionArray"
},
{
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/GeoProperty/properties/value/definitions/lineString"
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/properties/location/properties/value/definitions/lineString"
},
{
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/GeoProperty/properties/value/definitions/polygon"
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/properties/location/properties/value/definitions/polygon"
}
]
}
......@@ -218,7 +218,7 @@
"schema": {
"type": "array",
"items": {
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/Entity"
"$ref": "#/paths/~1entities~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema"
}
},
"examples": {
......@@ -264,7 +264,31 @@
"content": {
"application/json;application/ld+json": {
"schema": {
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/Entity"
"allOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uri"
},
"type": {
"$ref": "#/paths/~1entities~1%7BentityId%7D/get/parameters/2/schema"
},
"createdAt": {
"type": "string",
"format": "date-time"
},
"modifiedAt": {
"type": "string",
"format": "date-time"
}
}
},
{
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema"
}
]
}
}
}
......@@ -353,7 +377,7 @@
"content": {
"application/json;application/ld+json": {
"schema": {
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/Entity"
"$ref": "#/paths/~1entities~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema"
},
"examples": {
"simple": {
......@@ -456,110 +480,35 @@
"content": {
"application/json;application/ld+json": {
"schema": {
"$schema": "http://json-schema.org/schema#",
"id": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/Entity.json",
"title": "NGSI-LD Entity",
"description": "NGSI-LD Entity",
"definitions": {
"datasetId": {
"type": "string",
"format": "uri"
},
"instanceId": {
"type": "string",
"format": "uri"
},
"Property": {
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "Property"
"type": "object",
"properties": {
"@context": {
"anyOf": [
{
"type": "object"
},
"value": {
"type": [
"string",
"number",
"boolean",
"array",
"object"
]
},
"observedAt": {
"type": "string",
"format": "date-time"
},
"createdAt": {
"$ref": "#/paths/~1entities~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/properties/createdAt"
},
"modifiedAt": {
"$ref": "#/paths/~1entities~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/properties/modifiedAt"
},
"datasetId": {
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/datasetId"
},
"instanceId": {
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/instanceId"
}
},
"required": [
"type",
"value"
],
"additionalProperties": {
"anyOf": [
{
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/Property"
},
{
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/Relationship"
}
]
}
},
"Relationship": {
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "Relationship"
},
"object": {
{
"type": "string",
"format": "uri"
},
"observedAt": {
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/Property/properties/observedAt"
},
"createdAt": {
"$ref": "#/paths/~1entities~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/properties/createdAt"
},
"modifiedAt": {
"$ref": "#/paths/~1entities~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/properties/modifiedAt"
},
"datasetId": {
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/datasetId"
},
"instanceId": {
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/instanceId"
}
},
"required": [
"type",
"object"
],
"additionalProperties": {
"anyOf": [
{
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/Property"
},
{
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/Relationship"
{
"type": "array",
"minItems": 1,
"items": {
"anyOf": [
{
"type": "string",
"format": "uri"
},
{
"type": "object"
}
]
}
]
}
}
]
},
"GeoProperty": {
"location": {
"type": "object",
"properties": {
"type": {
......@@ -586,7 +535,7 @@
]
},
"coordinates": {
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/GeoProperty/properties/value/definitions/position"
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/properties/location/properties/value/definitions/position"
}
}
},
......@@ -599,7 +548,7 @@
]
},
"coordinates": {
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/GeoProperty/properties/value/definitions/positionArray"
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/properties/location/properties/value/definitions/positionArray"
}
}
},
......@@ -612,7 +561,7 @@
]
},
"coordinates": {
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/GeoProperty/properties/value/definitions/lineString"
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/properties/location/properties/value/definitions/lineString"
}
}
},
......@@ -627,7 +576,7 @@
"coordinates": {
"type": "array",
"items": {
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/GeoProperty/properties/value/definitions/lineString"
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/properties/location/properties/value/definitions/lineString"
}
}
}
......@@ -641,7 +590,7 @@
]
},
"coordinates": {
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/GeoProperty/properties/value/definitions/polygon"
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/properties/location/properties/value/definitions/polygon"
}
}
},
......@@ -656,7 +605,7 @@
"coordinates": {
"type": "array",
"items": {
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/GeoProperty/properties/value/definitions/polygon"
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/properties/location/properties/value/definitions/polygon"
}
}
}
......@@ -681,14 +630,14 @@
"description": "An array of positions",
"type": "array",
"items": {
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/GeoProperty/properties/value/definitions/position"
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/properties/location/properties/value/definitions/position"
}
},
"lineString": {
"description": "An array of two or more positions",
"allOf": [
{
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/GeoProperty/properties/value/definitions/positionArray"
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/properties/location/properties/value/definitions/positionArray"
},
{
"minItems": 2
......@@ -699,7 +648,7 @@
"description": "An array of four positions where the first equals the last",
"allOf": [
{
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/GeoProperty/properties/value/definitions/positionArray"
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/properties/location/properties/value/definitions/positionArray"
},
{
"minItems": 4
......@@ -710,25 +659,28 @@
"description": "An array of linear rings",
"type": "array",
"items": {
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/GeoProperty/properties/value/definitions/linearRing"
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/properties/location/properties/value/definitions/linearRing"
}
}
}
},
"observedAt": {
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/Property/properties/observedAt"
"type": "string",
"format": "date-time"
},
"createdAt": {
"$ref": "#/paths/~1entities~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/properties/createdAt"
"$ref": "#/paths/~1entities~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/allOf/0/properties/createdAt"
},
"modifiedAt": {
"$ref": "#/paths/~1entities~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/properties/modifiedAt"
"$ref": "#/paths/~1entities~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/allOf/0/properties/modifiedAt"
},
"datasetId": {
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/datasetId"
"type": "string",
"format": "uri"
},
"instanceId": {
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/instanceId"
"type": "string",
"format": "uri"
}
},
"required": [
......@@ -738,96 +690,125 @@
"additionalProperties": {
"anyOf": [
{
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/Property"
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/additionalProperties/anyOf/0"
},
{
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/Relationship"
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/additionalProperties/anyOf/1"
}
]
}
},
"Entity": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uri"
},
"type": {
<