From a950217d7916f8b358cef14e1224dc5cc56a9097 Mon Sep 17 00:00:00 2001 From: Jose Manuel Cantera Date: Wed, 14 Nov 2018 13:08:00 +0100 Subject: [PATCH] Refining Examples --- ...son => EntityTemporal-example_C5.5.3.json} | 0 examples/OffStreetParking_C2.3.json | 2 +- .../{Vehicle_C2.2.js => Vehicle_C2.2.json} | 2 +- schema/Entity.json | 2 +- schema/Entity_keyValues.json | 2 +- scripts/validate_examples.sh | 32 +++++++++++++++++++ 6 files changed, 36 insertions(+), 4 deletions(-) rename examples/{EntityTemportal-example_C5.5.3.json => EntityTemporal-example_C5.5.3.json} (100%) rename examples/{Vehicle_C2.2.js => Vehicle_C2.2.json} (93%) create mode 100755 scripts/validate_examples.sh diff --git a/examples/EntityTemportal-example_C5.5.3.json b/examples/EntityTemporal-example_C5.5.3.json similarity index 100% rename from examples/EntityTemportal-example_C5.5.3.json rename to examples/EntityTemporal-example_C5.5.3.json diff --git a/examples/OffStreetParking_C2.3.json b/examples/OffStreetParking_C2.3.json index 4e6918f..af6a059 100644 --- a/examples/OffStreetParking_C2.3.json +++ b/examples/OffStreetParking_C2.3.json @@ -8,7 +8,7 @@ "availableSpotNumber": { "type": "Property", "value": 121, - "observedAt": "2017-07-29T12:05:02", + "observedAt": "2017-07-29T12:05:02Z", "reliability": { "type": "Property", "value": 0.7 diff --git a/examples/Vehicle_C2.2.js b/examples/Vehicle_C2.2.json similarity index 93% rename from examples/Vehicle_C2.2.js rename to examples/Vehicle_C2.2.json index 858bf6e..4e062b2 100644 --- a/examples/Vehicle_C2.2.js +++ b/examples/Vehicle_C2.2.json @@ -8,7 +8,7 @@ "isParked": { "type": "Relationship", "object": "urn:ngsi-ld:OffStreetParking:Downtown1", - "observedAt": "2017-07-29T12:00:04", + "observedAt": "2017-07-29T12:00:04Z", "providedBy": { "type": "Relationship", "object": "urn:ngsi-ld:Person:Bob" diff --git a/schema/Entity.json b/schema/Entity.json index c98fd98..492b652 100644 --- a/schema/Entity.json +++ b/schema/Entity.json @@ -184,6 +184,6 @@ }, "propertyNames": { "type": "string", - "pattern": "^((\\d|[a-zA-Z]|_)+(#\\d+)?)$" + "pattern": "^((\\d|[a-zA-Z]|_)+(#\\d+)?)$|^(@context)$" } } diff --git a/schema/Entity_keyValues.json b/schema/Entity_keyValues.json index e78d348..a1f8839 100644 --- a/schema/Entity_keyValues.json +++ b/schema/Entity_keyValues.json @@ -46,6 +46,6 @@ }, "propertyNames": { "type": "string", - "pattern": "^((\\d|[a-zA-Z]|_)+(#\\d+)?)$" + "pattern": "^((\\d|[a-zA-Z]|_)+(#\\d+)?)$|^(@context)$" } } diff --git a/scripts/validate_examples.sh b/scripts/validate_examples.sh new file mode 100755 index 0000000..f9667d9 --- /dev/null +++ b/scripts/validate_examples.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +ajv validate -s $SCHEMAS/Entity.json -d $EXAMPLES/Entity-example.json -r $SCHEMAS/common.json -r $SCHEMAS/geometry-schema.json + +ajv validate -s $SCHEMAS/Entity.json -d $EXAMPLES/Vehicle_C2.2.json -r $SCHEMAS/common.json -r $SCHEMAS/geometry-schema.json + +ajv validate -s $SCHEMAS/Entity.json -d $EXAMPLES/OffStreetParking_C2.3.json -r $SCHEMAS/common.json -r $SCHEMAS/geometry-schema.json + +ajv validate -s $SCHEMAS/Entity_keyValues.json -d -d $EXAMPLES/Vehicle_keyValues_C2.2.json -r $SCHEMAS/common.json -r $SCHEMAS/geometry-schema.json + +ajv compile -s $SCHEMAS/subscriptions/Subscription.json -r $SCHEMAS/common.json -r $SCHEMAS/geometry-schema.json + +ajv compile -s $SCHEMAS/temporal/EntityTemporal.json -r $SCHEMAS/common.json -r $SCHEMAS/geometry-schema.json -r $SCHEMAS/Entity.json + +ajv compile -s $SCHEMAS/registrations/ContextSourceRegistration.json -r $SCHEMAS/common.json -r $SCHEMAS/geometry-schema.json + +ajv compile -s $SCHEMAS/subscriptions/Notification.json -r $SCHEMAS/common.json -r $SCHEMAS/geometry-schema.json -r $SCHEMAS/Entity.json + +ajv compile -s $SCHEMAS/registrations/ContextSourceNotification.json -r $SCHEMAS/common.json -r $SCHEMAS/geometry-schema.json -r $SCHEMAS/registrations/ContextSourceRegistration.json + +ajv compile -s $SCHEMAS/EntityList.json -r $SCHEMAS/common.json -r $SCHEMAS/geometry-schema.json -r $SCHEMAS/Entity.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 + +ajv compile -s $SCHEMAS/UpdateResult.json + + + +ajv compile -s $SCHEMAS/temporal/Entity_temporalValues.json -r $SCHEMAS/common.json -r $SCHEMAS/geometry-schema.json -r $SCHEMAS/Entity.json + -- GitLab