From 6eac82b49a0e78197f1a2687f0d48ddd991368e2 Mon Sep 17 00:00:00 2001 From: kzangeli Date: Sat, 19 Sep 2026 09:35:54 +0200 Subject: [PATCH] fix: percent-encoded quotes in a q inside a JSON body, and an x-ngsiv2 typo Four subscription payloads write the q string as "q": "filling>0.6;filling<0.8;controlledAsset==%22urn:ngsi-ld:Building:farm001%22" %22 is a percent-encoded double quote. Percent-decoding belongs to the URL layer, and this q is in a request BODY, where nothing decodes it - so the value seen by the broker is literally %22urn:ngsi-ld:Building:farm001%22, which is neither a quoted string nor a URI. A broker that validates the q grammar rejects it with 400. Replaced with JSON-escaped quotes, which is what the clause asks for and parses identically everywhere: "q": "filling>0.6;filling<0.8;controlledAsset==\"urn:ngsi-ld:Building:farm001\"" All five payloads on the page still parse as valid JSON. Also: 'x-nsgiv2-keyValues' and 'x-nsgiv2-keyValues-compacted' in the custom format list are misspellings of x-ngsiv2. --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 590de2b..d190f9d 100644 --- a/README.md +++ b/README.md @@ -249,7 +249,7 @@ curl -L -X POST \ "type": "Subscription", "entities": [{"type": "FillingLevelSensor"}], "watchedAttributes": ["filling"], - "q": "filling>0.6;filling<0.8;controlledAsset==%22urn:ngsi-ld:Building:farm001%22", + "q": "filling>0.6;filling<0.8;controlledAsset==\"urn:ngsi-ld:Building:farm001\"", "notification": { "attributes": ["filling", "controlledAsset"], "format": "keyValues", @@ -344,7 +344,7 @@ curl -L -X POST \ "type": "Subscription", "entities": [{"type": "FillingLevelSensor"}], "watchedAttributes": ["filling"], - "q": "filling>0.4;filling<0.6;controlledAsset==%22urn:ngsi-ld:Building:farm001%22", + "q": "filling>0.4;filling<0.6;controlledAsset==\"urn:ngsi-ld:Building:farm001\"", "notification": { "attributes": ["filling", "controlledAsset"], "format": "normalized", @@ -408,7 +408,7 @@ curl -L -X POST \ "type": "Subscription", "entities": [{"type": "FillingLevelSensor"}], "watchedAttributes": ["filling"], - "q": "filling<0.4;controlledAsset==%22urn:ngsi-ld:Building:farm001%22", + "q": "filling<0.4;controlledAsset==\"urn:ngsi-ld:Building:farm001\"", "notification": { "attributes": ["filling", "controlledAsset"], "format": "x-ngsiv2-normalized", @@ -459,8 +459,8 @@ When a `low-stock-farm001-ngsiv2` event is fired, the response is a normalzed NG As can be seen, by default the attributes are returned using URN long names. It is also possible to request that the Orion-LD context broker pre-applies a compaction operation to the payload. -- `x-nsgiv2-keyValues` - Key-value pairs with URN attribute names -- `x-nsgiv2-keyValues-compacted` - Key-value pairs with short name attribute aliases +- `x-ngsiv2-keyValues` - Key-value pairs with URN attribute names +- `x-ngsiv2-keyValues-compacted` - Key-value pairs with short name attribute aliases - `x-ngsiv2-normalized` - NGSI-v2 normalized payload with URN attribute names - `x-ngsiv2-normalized-compacted`- NGSI-v2 normalized payload pairs with short name attribute aliases @@ -491,7 +491,7 @@ curl -L -X POST \ "type": "Subscription", "entities": [{"type": "FillingLevelSensor"}], "watchedAttributes": ["filling"], - "q": "filling>0.2;filling<0.4;controlledAsset==%22urn:ngsi-ld:Building:farm001%22", + "q": "filling>0.2;filling<0.4;controlledAsset==\"urn:ngsi-ld:Building:farm001\"", "notification": { "attributes": ["filling", "controlledAsset"], "format": "keyValues",