diff --git a/schema/registrations/ContextSourceRegistration.json b/schema/registrations/ContextSourceRegistration.json index 84a570e61a8cb2b5c1d597f6325c4cf1fe2fc9ea..f5386bfd934671b51303d16a38c7efaa7304f04f 100644 --- a/schema/registrations/ContextSourceRegistration.json +++ b/schema/registrations/ContextSourceRegistration.json @@ -50,68 +50,93 @@ "format": "date-time" } } - } - }, - "type": "object", - "properties": { - "id": { - "type": "string", - "format": "uri" - }, - "type": { - "type": "string", - "const": "ContextSourceRegistration" - }, - "@context": { - "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/LdContext" - }, - "information": { - "type": "array", - "minItems": 1, - "items": { - "$ref": "#/definitions/RegistrationInfo" - } }, - "timestamp": { - "type": "array", - "minItems": 1, - "items": { - "$ref": "#/definitions/TimeInterval" + "ContextSourceRegistrationFragment": { + "type": "object", + "properties": { + "@context": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/LdContext" + }, + "information": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/RegistrationInfo" + } + }, + "timestamp": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/TimeInterval" + } + }, + "location": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/geometry-schema.json#" + }, + "expires": { + "type": "string", + "format": "date-time" + }, + "name": { + "type": "string", + "minLength": 1 + }, + "description": { + "type": "string", + "minLength": 1 + }, + "endpoint": { + "type": "string", + "format": "uri" + } + }, + "additionalProperties": { + "type": [ + "string", + "number", + "boolean", + "array", + "object" + ] } }, - "location": { - "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/geometry-schema.json#" - }, - "expires": { - "type": "string", - "format": "date-time" - }, - "name": { - "type": "string", - "minLength": 1 - }, - "description": { - "type": "string", - "minLength": 1 - }, - "endpoint": { - "type": "string", - "format": "uri" - }, - "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" + "ContextSourceRegistration": { + "allOf": [ + { + "$ref": "#/definitions/ContextSourceRegistrationFragment" + }, + { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uri" + }, + "type": { + "type": "string", + "const": "ContextSourceRegistration" + }, + "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", + "endpoint", + "information" + ] + } + ] } }, - "additionalProperties": { - "type": ["string", "number", "boolean", "array", "object"] - }, - "required": [ - "id", - "type", - "endpoint", - "information" + "allOf": [ + { + "$ref": "#/definitions/ContextSourceRegistration" + } ] -} +} \ No newline at end of file diff --git a/schema/registrations/ContextSourceRegistrationList.json b/schema/registrations/ContextSourceRegistrationList.json new file mode 100644 index 0000000000000000000000000000000000000000..243d391425309f18a20bf294a25ca24b1fcbadae --- /dev/null +++ b/schema/registrations/ContextSourceRegistrationList.json @@ -0,0 +1,17 @@ +{ + "$schema": "http://json-schema.org/schema#", + "id": "https://uri.etsi.org/ngsi-ld/schema/ContextSourceRegistrationList.json", + "title": "NGSI-LD Registration List", + "description": "NGSI-LD Registration List", + "definitions": { + "ContextSourceRegistrationList": { + "type": "array", + "items": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/registrations/ContextSourceRegistration.json#/definitions/ContextSourceRegistration" + } + } + }, + "allOf": [{ + "$ref": "#/definitions/ContextSourceRegistrationList" + }] +} diff --git a/scripts/validate_schema.sh b/scripts/validate_schema.sh index 6cf323d4c25e030c9604674932d3a73c23131ce8..2704581eca0152a230f2e15ffd037727044ea4b1 100755 --- a/scripts/validate_schema.sh +++ b/scripts/validate_schema.sh @@ -16,6 +16,8 @@ ajv compile -s $SCHEMAS/EntityList.json -r $SCHEMAS/common.json -r $SCHEMAS/geom ajv compile -s $SCHEMAS/subscriptions/SubscriptionList.json -r $SCHEMAS/common.json -r $SCHEMAS/geometry-schema.json -r $SCHEMAS/subscriptions/Subscription.json +ajv compile -s $SCHEMAS/registrations/ContextSourceRegistrationList.json -r $SCHEMAS/common.json -r $SCHEMAS/geometry-schema.json -r $SCHEMAS/registrations/ContextSourceRegistration.json + ajv compile -s $SCHEMAS/temporal/EntityTemporalList.json -r $SCHEMAS/temporal/EntityTemporal.json -r $SCHEMAS/Entity.json -r $SCHEMAS/common.json -r $SCHEMAS/geometry-schema.json ajv compile -s $SCHEMAS/BatchOperationResult.json -r $SCHEMAS/common.json diff --git a/spec/updated/csource-registrations-spec.json b/spec/updated/csource-registrations-spec.json new file mode 100644 index 0000000000000000000000000000000000000000..f69ca0e0e268b700fc49c04878536b96696ea96d --- /dev/null +++ b/spec/updated/csource-registrations-spec.json @@ -0,0 +1,90 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "NGSI-LD Registrations", + "version": "latest" + }, + "components": { + "parameters": { + } + }, + "paths": { + "/csourceRegistrations/": { + "get": { + "description": "Retrieve a set of context sources which matches a specific query from an NGSI-LD system", + "operationId": "queryCsources", + "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/registrations/ContextSourceRegistrationList.json#/definitions/ContextSourceRegistrationList" + }, + "examples": { + "simple": { + "externalValue": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/examples/ContextSourceRegistrationList-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": "Registers a new context source within an NGSI-LD system", + "operationId": "registerCsource", + "requestBody": { + "required": true, + "content": { + "application/json;application/ld+json": { + "schema": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/registrations/ContextSourceRegistration.json#/definitions/ContextSourceRegistration" + } + } + } + }, + "responses": { + "201": { + "description": "Created. Contains the resource URI of the created Registration" + }, + "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" + } + } + } + } + } + } + } + } +}