Commit 36297ca9 authored by kzangeli's avatar kzangeli
Browse files

fix: 020_19/020_20 — deleted scope is the NGSI-LD Null, not an empty array

TS 104-175 § 4.18's Scope ABNF states that the literal string
"urn:ngsi-ld:null" shall be only used and only appear in case of
deleted scopes; § 5.3.2.5's temporal deletion rule likewise substitutes
the NGSI-LD Null. The two expectation fixtures instead encoded the
deleted scope instance as an empty array ([]), which the grammar cannot
produce.

- vehicle-temporal-representation-property-020-19.jsonld:
  "value": [] → "value": "urn:ngsi-ld:null" (normalized)
- vehicle-temporal-representation-property-020-20.jsonld:
  [[], ts] → ["urn:ngsi-ld:null", ts] (temporalValues pair)

Analysis recorded as testsuite-doubts.md #91.
parent d9a20233
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
  "scope": [
    {
      "type": "Property",
      "value": [],
      "value": "urn:ngsi-ld:null",
      "deletedAt": "2024-12-19T08:43:32.422444Z"
    }
  ]
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
    "type": "Property",
    "values": [
      [
        [],
        "urn:ngsi-ld:null",
        "2024-12-19T08:48:50.936936Z"
      ]
    ]
+34 −0
Original line number Diff line number Diff line
@@ -2667,3 +2667,37 @@ doesn't match the URL id.
`$.id` with the actual `${entity_id}` before PATCHing. Or omit the
`id` from the fragment entirely (PATCH attrs doesn't need it).



## 91. `020_19_01` / `020_20_01` — deleted-scope expectations encode the NGSI-LD Null as `[]`

**Hit:** with the deletedAt-tombstone setup of [[#87]] in place, both scope
tests still fail on the expectation fixtures
(`vehicle-temporal-representation-property-020-19.jsonld` /
`…-020-20.jsonld`), which represent the deleted scope instance as an empty
array:

```json
{ "type": "Property", "value": [], "deletedAt": "…" }      (020-19, normalized)
[ [], "2024-12-19T08:48:50.936936Z" ]                      (020-20, temporalValues pair)
```

**Spec:** TS 104-175 § 4.18 defines the Scope grammar in ABNF and states that
the special string `"urn:ngsi-ld:null"` (the NGSI-LD Null) "shall be **only**
used and **only** appear in case of **deleted scopes**" — i.e. a deleted scope
is represented by that string, and nothing else may represent it:

```abnf
Scope =  [%x2F] ScopeLevel *(%x2F ScopeLevel)
Scope =/ "urn:ngsi-ld:null"        ; the literal string "urn:ngsi-ld:null"
```

An empty array is not derivable from the grammar at all (and § 5.3.2.5's
deletion rule for temporal instances likewise substitutes the NGSI-LD Null,
never an empty container).

**Fix:** in both expectation fixtures, replace the empty-array scope value
with the string `"urn:ngsi-ld:null"`:

- 020-19 (normalized): `"value": "urn:ngsi-ld:null"`
- 020-20 (temporalValues): `[ "urn:ngsi-ld:null", "…" ]`