From 63e61804a961bd0f08da384e7b02161b0c67d7d3 Mon Sep 17 00:00:00 2001 From: Jose Manuel Cantera Date: Mon, 19 Nov 2018 15:49:38 +0100 Subject: [PATCH] Refactoring schemas --- schema/common.json | 46 +++++++++ schema/subscriptions/Subscription.json | 43 +------- spec/updated/entities-spec.json | 133 +++++++++++++++++++++++++ 3 files changed, 182 insertions(+), 40 deletions(-) diff --git a/schema/common.json b/schema/common.json index 664fa1c..4ba40d8 100644 --- a/schema/common.json +++ b/schema/common.json @@ -104,5 +104,51 @@ "required": [ "type" ] + }, + "georel": { + "anyOf": [ + { + "type": "string", + "enum": [ + "equals", + "disjoint", + "intersects", + "within", + "contains", + "overlaps" + ] + }, + { + "type": "string", + "pattern": "^near;((maxDistance==\\d+)|(minDistance==\\d+))$" + } + ] + }, + "coordinates": { + "oneOf": [ + { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/geometry-schema.json#/definitions/position" + }, + { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/geometry-schema.json#/definitions/positionArray" + }, + { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/geometry-schema.json#/definitions/lineString" + }, + { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/geometry-schema.json#/definitions/polygon" + } + ] + }, + "geometry": { + "type": "string", + "enumeration": [ + "Point", + "MultiPoint", + "LineString", + "MultiLineString", + "Polygon", + "MultiPolygon" + ] } } diff --git a/schema/subscriptions/Subscription.json b/schema/subscriptions/Subscription.json index c18a37a..a504034 100644 --- a/schema/subscriptions/Subscription.json +++ b/schema/subscriptions/Subscription.json @@ -59,50 +59,13 @@ ], "properties": { "georel": { - "anyOf": [ - { - "type": "string", - "enum": [ - "equals", - "disjoint", - "intersects", - "within", - "contains", - "overlaps" - ] - }, - { - "type": "string", - "pattern": "^near;((maxDistance==\\d+)|(minDistance==\\d+))$" - } - ] + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/georel" }, "coordinates": { - "oneOf": [ - { - "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/geometry-schema.json#/definitions/position" - }, - { - "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/geometry-schema.json#/definitions/positionArray" - }, - { - "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/geometry-schema.json#/definitions/lineString" - }, - { - "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/geometry-schema.json#/definitions/polygon" - } - ] + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/coordinates" }, "geometry": { - "type": "string", - "enumeration": [ - "Point", - "MultiPoint", - "LineString", - "MultiLineString", - "Polygon", - "MultiPolygon" - ] + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/geometry" } } } diff --git a/spec/updated/entities-spec.json b/spec/updated/entities-spec.json index eea871a..0d7f6f1 100644 --- a/spec/updated/entities-spec.json +++ b/spec/updated/entities-spec.json @@ -4,11 +4,144 @@ "title": "NGSI-LD Entities", "version": "latest" }, + "components": { + "parameters": { + "id": { + "name": "id", + "description": "Comma separated list of URIs to be retrieved", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "uri" + } + }, + "type": { + "name": "type", + "description": "Comma separated list of Entity type names to be retrieved", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 1 + } + }, + "idPattern": { + "name": "idPattern", + "description": "Regular expression that must be matched by Entity ids", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 1 + } + }, + "attrs": { + "name": "attrs", + "description": "Comma separated list of attribute names (properties or relationships) to be retrieved", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 1 + } + }, + "q": { + "name": "q", + "description": "Query", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 1 + } + }, + "georel": { + "name": "georel", + "description": "Geo-relationship", + "in": "query", + "required": false, + "schema": { + "$ref": "" + } + }, + "geometry": { + "name": "geometry", + "description": "Geometry", + "in": "query", + "required": false, + "schema": { + "$ref": "" + } + }, + "coordinates": { + "name": "coordinates", + "description": "Coordinates serialized as a string", + "in": "query", + "required": false, + "schema": { + "$ref": "" + } + }, + "geoproperty": { + "name": "geoproperty", + "description": "The name of the property that contains the geo-spatial data that will be used to resolve the geoquery", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 1 + } + }, + "csf": { + "name": "csf", + "description": "Context Source Filter", + "in": "query", + "required": false, + "schema": { + "type": "string", + "minLength": 1 + } + } + } + }, "paths": { "/entities/": { "get": { "description": "Retrieve a set of entities which matches a specific query from an NGSI-LD system", "operationId": "queryEntities", + "parameters": [ + { + "$ref": "#/components/parameters/id" + }, + { + "$ref": "#/components/parameters/idPattern" + }, + { + "$ref": "#/components/parameters/type" + }, + { + "$ref": "#/components/parameters/attrs" + }, + { + "$ref": "#/components/parameters/q" + }, + { + "$ref": "#/components/parameters/georel" + }, + { + "$ref": "#/components/parameters/geometry" + }, + { + "$ref": "#/components/parameters/coordinates" + }, + { + "$ref": "#/components/parameters/geoproperty" + }, + { + "$ref": "#/components/parameters/csf" + } + ], "responses": { "200": { "description": "OK", -- GitLab