diff --git a/schema/temporal/EntityTemporal.json b/schema/temporal/EntityTemporal.json index f601268bed0f665cc2bf2c598bbf7a4339192c85..7c6d5bd3e42c974d073815ee8a27a0c6ab0f5c3e 100644 --- a/schema/temporal/EntityTemporal.json +++ b/schema/temporal/EntityTemporal.json @@ -1,65 +1,100 @@ { "$schema": "http://json-schema.org/schema#", - "id": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/EntityTemporal.json", + "id": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/temporal/EntityTemporal.json", "title": "NGSI-LD Entity", "description": "NGSI-LD Temporal Representation of an Entity", - "type": "object", - "properties": { - "id": { - "type": "string", - "format": "uri" - }, - "type": { - "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/Name" - }, - "@context": { - "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/LdContext" - }, - "location": { - "type": "array", - "items": { - "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/Entity.json#/definitions/GeoProperty" - }, - "minItems": 1 - }, - "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" - } - }, - "required": [ - "id", - "type" - ], - "additionalProperties": { - "anyOf": [ - { - "type": "array", - "items": { - "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/Entity.json#/definitions/Property" + "definitions": { + "EntityTemporalFragment": { + "type": "object", + "properties": { + "@context": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/LdContext" }, - "minItems": 1 - }, - { - "type": "array", - "items": { - "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/Entity.json#/definitions/Relationship" + "location": { + "type": "array", + "items": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/Entity.json#/definitions/GeoProperty" + }, + "minItems": 1 }, - "minItems": 1 - }, - { - "type": "array", - "items": { - "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/Entity.json#/definitions/GeoProperty" + "observationSpace": { + "type": "array", + "items": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/Entity.json#/definitions/GeoProperty" + }, + "minItems": 1 }, - "minItems": 1 + "operationSpace": { + "type": "array", + "items": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/Entity.json#/definitions/GeoProperty" + }, + "minItems": 1 + } + }, + "additionalProperties": { + "anyOf": [ + { + "type": "array", + "items": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/Entity.json#/definitions/Property" + }, + "minItems": 1 + }, + { + "type": "array", + "items": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/Entity.json#/definitions/Relationship" + }, + "minItems": 1 + }, + { + "type": "array", + "items": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/Entity.json#/definitions/GeoProperty" + }, + "minItems": 1 + } + ] + }, + "propertyNames": { + "type": "string", + "pattern": "^((\\d|[a-zA-Z]|_)+(#\\d+)?)$|^(@context)$" } - ] + }, + "EntityTemporal": { + "allOf": [ + { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uri" + }, + "type": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/Name" + }, + "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" + } + }, + "required": [ + "id", + "type" + ] + }, + { + "$ref": "#/definitions/EntityTemporalFragment" + } + ] + } }, - "propertyNames": { - "type": "string", - "pattern": "^((\\d|[a-zA-Z]|_)+(#\\d+)?)$|^(@context)$" - } + "allOf": [ + { + "$ref": "#/definitions/EntityTemporal" + } + ] } diff --git a/schema/temporal/EntityTemporalList.json b/schema/temporal/EntityTemporalList.json index 22b7de02a4f7f7c1a82dcb687ee90290b8d7996c..16f41cab9819c5e963fe79b8e65b33020f609f08 100644 --- a/schema/temporal/EntityTemporalList.json +++ b/schema/temporal/EntityTemporalList.json @@ -1,10 +1,10 @@ { "$schema": "http://json-schema.org/schema#", - "id": "https://uri.etsi.org/ngsi-ld/schema/EntityTemporalList.json", + "id": "https://uri.etsi.org/ngsi-ld/schema/temporal/EntityTemporalList.json", "title": "NGSI-LD Entity", "description": "NGSI-LD Temporal Representation List", "type": "array", "items": { - "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/EntityTemporal.json#" + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/temporal/EntityTemporal.json#" } } diff --git a/spec/updated/temporal/temporal-entities-spec.json b/spec/updated/temporal/temporal-entities-spec.json new file mode 100644 index 0000000000000000000000000000000000000000..292052b30c1d733124ca19338bee47a1d58941bb --- /dev/null +++ b/spec/updated/temporal/temporal-entities-spec.json @@ -0,0 +1,193 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "NGSI-LD Temporal Entities", + "version": "latest" + }, + "components": { + "parameters": { + "timerel": { + "name": "timerel", + "description": "Time relationship", + "in": "query", + "required": false, + "schema": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/timerel" + } + }, + "time": { + "name": "time", + "description": "start time for temporal query", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "date-time" + } + }, + "endTime": { + "name": "endTime", + "description": "end time for temporal query", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "date-time" + } + }, + "timeproperty": { + "name": "timeproperty", + "description": "The name of the property that contains the temporal data that will be used to resolve the temporal query", + "in": "query", + "required": false, + "schema": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/Name" + } + }, + "options": { + "name": "options", + "description": "Options dictionary", + "in": "query", + "required": false, + "schema": { + "type": "string", + "enum": ["temporalValues", "sysAttrs"] + } + } + } + }, + "paths": { + "/temporal/entities/": { + "get": { + "description": "Query temporal evolution of Entities from an NGSI-LD system", + "operationId": "queryTemporalEntities", + "parameters": [ + { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/entities-spec.json#/components/parameters/id" + }, + { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/entities-spec.json#/components/parameters/idPattern" + }, + { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/entities-spec.json#/components/parameters/type" + }, + { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/entities-spec.json#/components/parameters/attrs" + }, + { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/entities-spec.json#/components/parameters/q" + }, + { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/entities-spec.json#/components/parameters/georel" + }, + { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/entities-spec.json#/components/parameters/geometry" + }, + { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/entities-spec.json#/components/parameters/coordinates" + }, + { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/entities-spec.json#/components/parameters/geoproperty" + }, + { + "$ref": "#/components/parameters/timerel" + }, + { + "$ref": "#/components/parameters/temporalproperty" + }, + { + "$ref": "#/components/parameters/time" + }, + { + "$ref": "#/components/parameters/endTime" + }, + { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/entities-spec.json#/components/parameters/csf" + }, + { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/entities-spec.json#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/options" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json;application/ld+json": { + "schema": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/EntityTemporalList.json#/definitions/EntityTemporalList" + }, + "examples": { + "simple": { + "externalValue": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/examples/EntityTemporalList-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": "Create temporal representation of an Entity within an NGSI-LD system", + "operationId": "createEntityTemporal", + "requestBody": { + "required": true, + "content": { + "application/json;application/ld+json": { + "schema": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/EntityTemporal.json#/definitions/EntityTemporal" + } + } + } + }, + "responses": { + "201": { + "description": "Created. Contains the resource URI of the created Entity" + }, + "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" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json;application/ld+json": { + "schema": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails" + } + } + } + } + } + } + } + } +} diff --git a/spec/updated/temporal/temporal-entity-attrs-spec.json b/spec/updated/temporal/temporal-entity-attrs-spec.json new file mode 100644 index 0000000000000000000000000000000000000000..c30f1bca9c748d1595b5ed4a7511e67f709f2066 --- /dev/null +++ b/spec/updated/temporal/temporal-entity-attrs-spec.json @@ -0,0 +1,243 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "NGSI-LD Entity Attributes", + "version": "latest" + }, + "components": { + "parameters": { + "entityId": { + "name": "entityId", + "description": "Entity Id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + }, + "attrId": { + "name": "attrId", + "description": "Attribute Id", + "in": "path", + "required": true, + "schema": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/Name" + } + }, + "options": { + "name": "options", + "description": "Indicates that no attribute overwrite shall be performed", + "in": "query", + "required": false, + "schema": { + "type": "string", + "enum": [ + "noOverwrite" + ] + } + } + } + }, + "paths": { + "/temporal/entities/{entityId}/attrs/": { + "post": { + "description": "Append new Entity attributes to an existing Entity within an NGSI-LD system", + "operationId": "appendEntityAttrs", + "parameters": [ + { + "$ref": "#/components/parameters/entityId" + }, + { + "$ref": "#/components/parameters/options" + } + ], + "requestBody": { + "required": true, + "content": { + "application/json;application/ld+json": { + "schema": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/Entity.json#/definitions/EntityFragment" + } + } + } + }, + "responses": { + "204": { + "description": "No Content" + }, + "207": { + "description": "Partial Success. Only the attributes included in the response payload were successfully appended", + "content": { + "application/json;application/ld+json": { + "schema": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/UpdateResult.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" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json;application/ld+json": { + "schema": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails" + } + } + } + } + } + }, + "patch": { + "description": "Update existing Entity attributes within an NGSI-LD system", + "operationId": "updateEntityAttrs", + "parameters": [ + { + "$ref": "#/components/parameters/entityId" + } + ], + "requestBody": { + "required": true, + "content": { + "application/json;application/ld+json": { + "schema": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/Entity.json#/definitions/EntityFragment" + } + } + } + }, + "responses": { + "204": { + "description": "No Content." + }, + "207": { + "description": "Partial Success. Only the attributes included in the response payload were successfully updated", + "content": { + "application/json;application/ld+json": { + "schema": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/UpdateResult.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" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json;application/ld+json": { + "schema": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails" + } + } + } + } + } + } + }, + "/temporal/entities/{entityId}/attrs/{attrId}": { + "patch": { + "description": "Update existing Entity attributes within an NGSI-LD system", + "operationId": "partialAttrUpdate", + "parameters": [ + { + "$ref": "#/components/parameters/entityId" + }, + { + "$ref": "#/components/parameters/attrId" + } + ], + "requestBody": { + "required": true, + "content": { + "application/json;application/ld+json": { + "schema": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/Entity.json#/definitions/EntityFragment" + } + } + } + }, + "responses": { + "204": { + "description": "No Content." + }, + "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" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json;application/ld+json": { + "schema": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails" + } + } + } + } + } + }, + "delete": { + "description": "Removes an existing Entity attribute within an NGSI-LD system", + "operationId": "removeEntityAttr", + "parameters": [ + { + "$ref": "#/components/parameters/entityId" + }, + { + "$ref": "#/components/parameters/attrId" + } + ], + "responses": { + "204": { + "description": "No Content." + }, + "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" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json;application/ld+json": { + "schema": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails" + } + } + } + } + } + } + } + } +} diff --git a/spec/updated/temporal/temporal-entity-by-id-spec.json b/spec/updated/temporal/temporal-entity-by-id-spec.json new file mode 100644 index 0000000000000000000000000000000000000000..cd03a979955396fa92f15cefd1ff3ae36fa529a4 --- /dev/null +++ b/spec/updated/temporal/temporal-entity-by-id-spec.json @@ -0,0 +1,105 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "NGSI-LD Entity Temporal By Id", + "version": "latest" + }, + "components": { + }, + "paths": { + "/temporal/entities/{entityId}": { + "get": { + "description": "Retrieve the temporal representation of an specific Entity from an NGSI-LD system. It's possible to specify the Entity attributes to be retrieved by using query parameters", + "operationId": "retrieveEntityTemporalById", + "parameters": [ + { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/entity-by-id-spec.json#/components/parameters/entityId" + }, + { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/entity-by-id-spec.json#/components/parameters/attrs" + }, + { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/entity-by-id-spec.json#/components/parameters/type" + }, + { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/temporal/temporal-entities-spec.json#/components/parameters/options" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json;application/ld+json": { + "schema": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/EntityTemporal.json#/definitions/EntityTemporal" + }, + "examples": { + "simple": { + "externalValue": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/examples/EntityTemporal-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" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json;application/ld+json": { + "schema": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails" + } + } + } + } + } + }, + "delete": { + "description": "Removes an specific Entity from an NGSI-LD system", + "operationId": "removeEntityById", + "parameters": [ + { + "$ref": "#/components/parameters/entityId" + }, + { + "$ref": "#/components/parameters/type" + } + ], + "responses": { + "204": { + "description": "No Content. The entity was removed successfully" + }, + "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" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json;application/ld+json": { + "schema": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails" + } + } + } + } + } + } + } + } +} \ No newline at end of file