Skip to content

Decode dictionary keys once at the deserialization boundary instead of in every consumer - #21

Merged
amateescu merged 1 commit into
mainfrom
normalize-dictionary-keys
Jul 17, 2026
Merged

amateescu merged 1 commit into
mainfrom
normalize-dictionary-keys

Conversation

@amateescu

Copy link
Copy Markdown
Owner

Dictionary keys admitted a raw array (the un-decoded PROV-JSON {"$":...,"type":...} shape), so every consumer re-decoded them and keySignature() did it via a helper that silently mis-signed non-xsd/prov prefixes.

Now keys are decoded once, at deserialization:

  • Tighten DictionaryEntry::$key and DictionaryRemoval::$removedKeys to QualifiedName|Literal|string|int|float|bool (no raw array).
  • JsonSerializer routes every array-shaped key through deserializeTypedValue(), so a malformed typed-literal throws DeserializationException instead of leaking downstream.
  • Remove the dead array-handling branches in keySignature() (and expandDatatypePrefix()), formatDictKey(), addDictKeyEntitySet()/addDictKeySet(), and remapDictKey().

Well-formed input is unchanged; malformed keys now fail loudly at parse time.

@amateescu
amateescu merged commit 7f824c1 into main Jul 17, 2026
7 checks passed
@amateescu
amateescu deleted the normalize-dictionary-keys branch July 17, 2026 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant