w3c / did-core

W3C Decentralized Identifier Specification v1.0
https://www.w3.org/TR/did-core/
Other
404 stars 94 forks source link

Solution for production of representation specific properties #662

Closed OR13 closed 3 years ago

OR13 commented 3 years ago

instead of thinking about production as a function of the ADM, let us think of it as a function of the ADM and the representation....

So for example:

const produce = (adm: infra<map>, representation: infra<map>) => {
  let didDocument = {...adm, ...representation};
  return serialize(didDocument);
}

the production rules can then apply normative requirements to both the adm and the representation, and their combination....

consumption remains the same, no need for "special buckets" or dangerous complexity.... if you consume JSON-LD and produce JSON, @context is preserved... if you consume JSON and produce JSON-LD you add the context during production and it never gets added to the ADM...

The same would apply to any representation specific properties... they are ALWAYS preserved on consumption, and ALWAYS required as a second argument of production.

msporny commented 3 years ago

Doh, didn't see this before creating https://github.com/w3c/did-core/issues/664 -- the issues are related, don't know if you agree that overlap is 100%... you make the call -- do you want to merge, or keep these separate? I'd prefer to merge and have the entire discussion in one thread.

OR13 commented 3 years ago

Also related: https://github.com/w3c/did-core/pull/654#issuecomment-780635390