Commit c4f887f1 authored by canterafonsj's avatar canterafonsj
Browse files

Subscriptions OAS first stab

parent bb5216fd
Loading
Loading
Loading
Loading
+37 −0
Original line number Diff line number Diff line
[
 {
  "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"
  ]
}
]
+111 −92
Original line number Diff line number Diff line
@@ -68,18 +68,10 @@
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/geometry"
        }
      }
    }
    },
    "SubscriptionFragment": {
      "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"
        },
@@ -98,9 +90,6 @@
          "type": "string",
          "minLength": 1
        },
    "notification": {
      "$ref": "#/definitions/NotificationParams"
    },
        "watchedAttributes": {
          "type": "array",
          "minItems": 1,
@@ -117,14 +106,6 @@
          "type": "string",
          "format": "date-time"
        },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "paused",
        "expired"
      ]
    },
        "isActive": {
          "type": "boolean"
        },
@@ -141,12 +122,41 @@
        "csf": {
          "type": "string"
        }
      }
    },
    "Subscription": {
      "allOf": [
        {
          "$ref": "#/definitions/SubscriptionFragment"
        },
        {
          "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": [
            {
@@ -171,3 +181,12 @@
            }
          ]
        }
      ]
    }
  },
  "allOf": [
    {
      "$ref": "#/definitions/Subscription"
    }
  ]
}
+17 −0
Original line number Diff line number Diff line
{
  "$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"
  }]
}