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 @@ ...@@ -68,106 +68,125 @@
"$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/geometry" "$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": { "SubscriptionFragment": {
"type": "string" "type": "object",
}, "properties": {
"geoQ": { "@context": {
"$ref": "#/definitions/GeoQuery" "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/LdContext"
}, },
"csf": { "entities": {
"type": "string" "type": "array",
} "items": {
}, "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/EntityInfo"
"createdAt": { },
"$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/createdAt" "minItems": 1
}, },
"modifiedAt": { "name": {
"$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/modifiedAt" "type": "string",
}, "minLength": 1
"allOf": [ },
{ "description": {
"required": [ "type": "string",
"id", "minLength": 1
"type" },
] "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"
}
}
}, },
{ "Subscription": {
"anyOf": [ "allOf": [
{ {
"required": [ "$ref": "#/definitions/SubscriptionFragment"
"entities"
]
}, },
{ {
"required": [ "type": "object",
"watchedAttributes" "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 @@ ...@@ -152,16 +152,16 @@
"schema": { "schema": {
"oneOf": [ "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 @@ ...@@ -218,7 +218,7 @@
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "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": { "examples": {
...@@ -264,7 +264,31 @@ ...@@ -264,7 +264,31 @@
"content": { "content": {
"application/json;application/ld+json": { "application/json;application/ld+json": {
"schema": { "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 @@ ...@@ -353,7 +377,7 @@
"content": { "content": {
"application/json;application/ld+json": { "application/json;application/ld+json": {
"schema": { "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": { "examples": {
"simple": { "simple": {
...@@ -456,110 +480,35 @@ ...@@ -456,110 +480,35 @@
"content": { "content": {
"application/json;application/ld+json": { "application/json;application/ld+json": {
"schema": { "schema": {
"$schema": "http://json-schema.org/schema#", "type": "object",
"id": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/Entity.json", "properties": {
"title": "NGSI-LD Entity", "@context": {
"description": "NGSI-LD Entity", "anyOf": [
"definitions": { {
"datasetId": { "type": "object"
"type": "string",
"format": "uri"
},
"instanceId": {
"type": "string",
"format": "uri"
},
"Property": {
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "Property"
}, },
"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", "type": "string",
"format": "uri" "format": "uri"
}, },
"observedAt": { {
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/Property/properties/observedAt" "type": "array",
}, "minItems": 1,
"createdAt": { "items": {
"$ref": "#/paths/~1entities~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/properties/createdAt" "anyOf": [
}, {
"modifiedAt": { "type": "string",
"$ref": "#/paths/~1entities~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/properties/modifiedAt" "format": "uri"
}, },
"datasetId": { {
"$ref": "#/paths/~1entities~1%7BentityId%7D~1attrs~1/post/requestBody/content/application~1json%3Bapplication~1ld%2Bjson/schema/definitions/datasetId" "type": "object"
}, }
"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"
} }
] }
} ]
}, },
"GeoProperty": { "location": {
"type": "object", "type": "object",
"properties": { "properties": {
"type": { "type": {
...@@ -586,7 +535,7 @@ ...@@ -586,7 +535,7 @@
] ]
}, },
"coordinates": { "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 @@ ...@@ -599,7 +548,7 @@
] ]
}, },
"coordinates": { "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 @@ ...@@ -612,7 +561,7 @@
] ]
}, },
"coordinates": { "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 @@ ...@@ -627,7 +576,7 @@
"coordinates": { "coordinates": {
"type": "array", "type": "array",
"items": { "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 @@ ...@@ -641,7 +590,7 @@
] ]
}, },
"coordinates": { "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 @@ ...@@ -656,7 +605,7 @@
"coordinates": { "coordinates": {
"type": "array", "type": "array",
"items": { "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 @@ ...@@ -681,14 +630,14 @@
"description": "An array of positions", "description": "An array of positions",
"type": "array", "type": "array",
"items": { "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": { "lineString": {
"description": "An array of two or more positions", "description": "An array of two or more positions",
"allOf": [ "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"
},