@@ -118,7 +118,8 @@ In the example, this JSONata file is hosted at `https://raw.githubusercontent.co
118
118
The JSON input messages must each be on one single line, and wrapped into a Node-RED structure ` {"payload":...} `
119
119
120
120
``` sh
121
- echo ' {"payload":{"id":"vehicle:WasteManagement:1","type":"BasicVehicle","vehicleType":"lorry","category1":"municipalServices","latitude":-3.164485591715449,"longitude":40.62785133667262,"name":"C Recogida 1","speed":50,"cargoWeight":314,"serviceStatus":"onRoute","serviceProvided1":"garbageCollection","serviceProvided2":"wasteContainerCleaning","areaServed":"Centro","refVehicleModel":"vehiclemodel:econic","vehiclePlateIdentifier":"3456ABC"}}' | node ./index.js json-multi-schema-transformer --transformsUrl=' "https://raw.githubusercontent.com/alexandrainst/node-red-contrib-json-multi-schema/master/examples/smart-data-transforms.json"'
121
+ echo ' {"payload":{"id":"vehicle:WasteManagement:1","type":"BasicVehicle","vehicleType":"lorry","category1":"municipalServices","latitude":-3.164485591715449,"longitude":40.62785133667262,"name":"C Recogida 1","speed":50,"cargoWeight":314,"serviceStatus":"onRoute","serviceProvided1":"garbageCollection","serviceProvided2":"wasteContainerCleaning","areaServed":"Centro","refVehicleModel":"vehiclemodel:econic","vehiclePlateIdentifier":"3456ABC"}}' | \
122
+ node ./index.js json-multi-schema-transformer --transformsUrl=' "https://raw.githubusercontent.com/alexandrainst/node-red-contrib-json-multi-schema/master/examples/smart-data-transforms.json"'
122
123
```
123
124
124
125
Output:
@@ -198,7 +199,8 @@ In the example, this JSON file is hosted at `https://raw.githubusercontent.com/a
198
199
The JSON input messages must each be on one single line, and wrapped into a Node-RED structure ` {"payload":...} `
199
200
200
201
``` sh
201
- echo ' {"payload":{"id":"vehicle:WasteManagement:1","type":"Vehicle","vehicleType":"lorry","category":["municipalServices"],"location":{"type":"Point","coordinates":[40.62785133667262,-3.164485591715449]},"name":"C Recogida 1","speed":50,"cargoWeight":314,"serviceStatus":"onRoute","serviceProvided":["garbageCollection","wasteContainerCleaning"],"areaServed":"Centro","refVehicleModel":"vehiclemodel:econic","vehiclePlateIdentifier":"3456ABC"}}' | node ./index.js json-multi-schema-resolver --mappingsUrl=' "https://raw.githubusercontent.com/alexandrainst/node-red-contrib-json-multi-schema/master/examples/smart-data-models.json"'
202
+ echo ' {"payload":{"id":"vehicle:WasteManagement:1","type":"Vehicle","vehicleType":"lorry","category":["municipalServices"],"location":{"type":"Point","coordinates":[40.62785133667262,-3.164485591715449]},"name":"C Recogida 1","speed":50,"cargoWeight":314,"serviceStatus":"onRoute","serviceProvided":["garbageCollection","wasteContainerCleaning"],"areaServed":"Centro","refVehicleModel":"vehiclemodel:econic","vehiclePlateIdentifier":"3456ABC"}}' | \
203
+ node ./index.js json-multi-schema-resolver --mappingsUrl=' "https://raw.githubusercontent.com/alexandrainst/node-red-contrib-json-multi-schema/master/examples/smart-data-models.json"'
202
204
```
203
205
204
206
Output:
@@ -251,7 +253,8 @@ This is an example of [standard payload](https://fiware-datamodels.readthedocs.i
251
253
The JSON input messages must each be on one single line, and wrapped into a Node-RED structure ` {"payload":...} `
252
254
253
255
``` sh
254
- echo ' {"payload":{"id":"vehicle:WasteManagement:1","type":"Vehicle","vehicleType":"lorry","category":["municipalServices"],"location":{"type":"Point","coordinates":[40.62785133667262,-3.164485591715449]},"name":"C Recogida 1","speed":50,"cargoWeight":314,"serviceStatus":"onRoute","serviceProvided":["garbageCollection","wasteContainerCleaning"],"areaServed":"Centro","refVehicleModel":"vehiclemodel:econic","vehiclePlateIdentifier":"3456ABC"},"schemaUrl":"https://smart-data-models.github.io/data-models/specs/Transportation/Vehicle/Vehicle/schema.json"}' | node ./index.js json-multi-schema-validator
256
+ echo ' {"payload":{"id":"vehicle:WasteManagement:1","type":"Vehicle","vehicleType":"lorry","category":["municipalServices"],"location":{"type":"Point","coordinates":[40.62785133667262,-3.164485591715449]},"name":"C Recogida 1","speed":50,"cargoWeight":314,"serviceStatus":"onRoute","serviceProvided":["garbageCollection","wasteContainerCleaning"],"areaServed":"Centro","refVehicleModel":"vehiclemodel:econic","vehiclePlateIdentifier":"3456ABC"},"schemaUrl":"https://smart-data-models.github.io/data-models/specs/Transportation/Vehicle/Vehicle/schema.json"}' | \
257
+ node ./index.js json-multi-schema-validator
255
258
```
256
259
257
260
Output:
@@ -275,7 +278,10 @@ Cf. screenshot at the top of this document.
275
278
276
279
### Piping on command line
277
280
``` sh
278
- echo ' {"payload":{"id":"vehicle:WasteManagement:1","type":"BasicVehicle","vehicleType":"lorry","category1":"municipalServices","latitude":-3.164485591715449,"longitude":40.62785133667262,"name":"C Recogida 1","speed":50,"cargoWeight":314,"serviceStatus":"onRoute","serviceProvided1":"garbageCollection","serviceProvided2":"wasteContainerCleaning","areaServed":"Centro","refVehicleModel":"vehiclemodel:econic","vehiclePlateIdentifier":"3456ABC"}}' | node ./index.js json-multi-schema-transformer --transformsUrl=' "https://raw.githubusercontent.com/alexandrainst/node-red-contrib-json-multi-schema/master/examples/smart-data-transforms.json"' | node ./index.js json-multi-schema-resolver --mappingsUrl=' "https://raw.githubusercontent.com/alexandrainst/node-red-contrib-json-multi-schema/master/examples/smart-data-models.json"' | node ./index.js json-multi-schema-validator
281
+ echo ' {"payload":{"id":"vehicle:WasteManagement:1","type":"BasicVehicle","vehicleType":"lorry","category1":"municipalServices","latitude":-3.164485591715449,"longitude":40.62785133667262,"name":"C Recogida 1","speed":50,"cargoWeight":314,"serviceStatus":"onRoute","serviceProvided1":"garbageCollection","serviceProvided2":"wasteContainerCleaning","areaServed":"Centro","refVehicleModel":"vehiclemodel:econic","vehiclePlateIdentifier":"3456ABC"}}' | \
282
+ node ./index.js json-multi-schema-transformer --transformsUrl=' "https://raw.githubusercontent.com/alexandrainst/node-red-contrib-json-multi-schema/master/examples/smart-data-transforms.json"' | \
283
+ node ./index.js json-multi-schema-resolver --mappingsUrl=' "https://raw.githubusercontent.com/alexandrainst/node-red-contrib-json-multi-schema/master/examples/smart-data-models.json"' | \
284
+ node ./index.js json-multi-schema-validator
279
285
```
280
286
281
287
_ Note_ : This is the example used for ` npm test `
@@ -295,7 +301,8 @@ Example from an URL:
295
301
curl ' https://broker.fiware.urbanplatform.portodigital.pt/v2/entities?limit=10&options=keyValues' | \
296
302
jq -c ' .[] | {"payload":.}' | \
297
303
node ./index.js json-multi-schema-resolver --mappingsUrl=' "https://raw.githubusercontent.com/alexandrainst/node-red-contrib-json-multi-schema/master/examples/smart-data-models.json"' | \
298
- node ./index.js json-multi-schema-validator | jq -c .
304
+ node ./index.js json-multi-schema-validator | \
305
+ jq -c .
299
306
```
300
307
301
308
@@ -317,6 +324,8 @@ By default, the cache path is `/tmp/` but that can be changed with the environme
317
324
318
325
## Docker
319
326
327
+ * [ ![ Docker] ( https://www.docker.com/sites/default/files/horizontal.png )] ( https://hub.docker.com/repository/docker/synchronicityiot/node-red-contrib-json-multi-schema )
328
+
320
329
### Build
321
330
322
331
``` sh
0 commit comments