Commit 40e9d27f authored by kzangeli's avatar kzangeli
Browse files

fix: 034_05_01 unset expiresAt via the urn:ngsi-ld:null sentinel

The fixture sent real JSON null to unset expiresAt. NGSI-LD does not use
JSON null as a delete signal — JSON-LD expansion drops null members before
the merge, so the update is a no-op. TS 104-175 clause-8 defines the string
sentinel "urn:ngsi-ld:null" for member deletion in partial-update/merge.

Send { "expiresAt": "urn:ngsi-ld:null" } instead (a string, so it survives
expansion under Content-Type: application/json). Updated doubts entry #48 to
record both the fixture flip and the matching broker-side delete-marker fix.
parent f9fa61d8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
{
   "expiresAt": null
   "expiresAt": "urn:ngsi-ld:null"
}
 No newline at end of file
+21 −10
Original line number Diff line number Diff line
@@ -1262,7 +1262,7 @@ attrs/{empty}/... routes (016_02_05 is the same shape but uses
`invalid(Id` instead of empty and asserts 400 — broker matches).


## 48. `034_05_01` — fixture uses real JSON null to unset `expiresAt`
## 48. `034_05_01` — fixture uses real JSON null (test bug) + broker did not honour the `urn:ngsi-ld:null` delete-marker on update (broker gap). Both fixed.

**Hit:** `PATCH /csourceRegistrations/{id}` with body
`{ "expiresAt": null }` (real JSON null). Test expects **204**
@@ -1279,15 +1279,26 @@ members whose value is `null` *before* the request body is
interpreted. So a JSON-LD-conformant pre-processor sees
**no** `expiresAt` member at all — the merge becomes a no-op.

**Broker:** rejects with **400** "'expiresAt' must be a DateTime
string". Correct per TS 104-175 § 5.2.6.4.8 — null is not a valid
DateTime, and the sentinel `"urn:ngsi-ld:null"` was designed
precisely to make this case unambiguous.

**Fix wanted:** the fixture should send
`{ "expiresAt": "urn:ngsi-ld:null" }` (with `Content-Type:
application/json` — the sentinel survives JSON-LD expansion
because it is a string, not null). The broker is correct.
**Two coupled defects.**

*Test bug:* sending real JSON null is wrong — null is not a valid
DateTime and JSON-LD expansion drops it before the merge, so the
update becomes a no-op. The fixture must send the sentinel
`{ "expiresAt": "urn:ngsi-ld:null" }` (a string, so it survives
JSON-LD expansion under `Content-Type: application/json`).
**Fixed:** fixture flipped to the sentinel.

*Broker gap:* the broker rejected the sentinel string too —
`400 "'expiresAt' is not a valid ISO 8601 DateTime"` — because
the delete-marker (`urn:ngsi-ld:null`) was never honoured on the
Update Registration / Update Subscription paths (only on the
entity merge path). So the fixture flip ALONE stayed red. **Fixed
in the broker:** the sentinel on a first-level fragment member is
now treated as a member-delete on update (TS 104-175 clause-8
merge rule → DB `$unset`); raw JSON null is rejected; mandatory
members cannot be deleted.

With both fixes `034_05_01` passes (204, `expiresAt` gone).


## 49. `001_05_02 / 003_04_02 / 003_05_02 / 010_04_01 / 033_05_01` — fixtures key on the expanded IRI in plain-JSON responses