w3c-ccg / traceability-interop

Verifiable Credentials for Supply Chain Interoperability Specification for HTTP

Home Page:https://w3id.org/traceability/interoperability

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Duplicate JSON Keys in request

mkhraisha opened this issue · comments

by duplicate keys I mean:

{
 "a": "test string 1",
 "a": "test string 2"
}

What should the issuer do when presented a credential to issue with duplicate keys?
JSON spec is silent on this: https://www.rfc-editor.org/rfc/rfc8259#section-4
JSON-LD spec says no duplicate keys: https://www.w3.org/TR/json-ld11/#json-ld-grammar

  1. return a 400 bad request
  2. use the second value, i.e. "test string 2"

Most JSON/JSON-LD libraries use option 2 when processing JSON input

Request for a conformance test?

Test should throw 400 on duplicate keys.

Make the test for a mandatory field like issuer.

I believe most json processing libraries by default go with option 2, and silently drop the first term.
Body-parser etc.

Will autoclose once relevant PR is merged