Commit c4f887f1 authored by canterafonsj's avatar canterafonsj

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"
}]
}
This diff is collapsed.
{
"openapi": "3.0.1",
"info": {
"title": "NGSI-LD Subscriptions",
"version": "latest"
},
"components": {
"parameters": [
"limit": {
"name": "limit",
"description": "Pagination limit",
"in": "query",
"required": false,
"schema": {
"type": "integer",
"minimum": 1
}
}
]
},
"paths": {
"/subscriptions/": {
"get": {
"description": "Retrieves the subscriptions available in an NGSI-LD system",
"operationId": "retrieveSubscriptions",
"parameters": [
{
"$ref": "#/components/parameters/limit"
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json;application/ld+json": {
"schema": {
"$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/subscriptions/SubscriptionList.json#/definitions/SubscriptionList"
},
"examples": {
"simple": {
"externalValue": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/examples/SubscriptionList-example.json"
}
}
}
}
},
"400": {
"description": "Bad request",
"content": {
"application/json;application/ld+json": {
"schema": {
"$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails"
}
}
}
}
}
},
"post": {
"description": "Creates a new Subscription within an NGSI-LD system",
"operationId": "createSubscription",
"requestBody": {
"required": true,
"content": {
"application/json;application/ld+json": {
"schema": {
"$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/subscriptions/Subscription.json#/definitions/Subscription"
}
}
}
},
"responses": {
"201": {
"description": "Created. Contains the resource URI of the created Subscription"
},
"400": {
"description": "Bad request",
"content": {
"application/json;application/ld+json": {
"schema": {
"$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails"
}
}
}
},
"409": {
"description": "Already exists",
"content": {
"application/json;application/ld+json": {
"schema": {
"$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails"
}
}
}
}
}
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment