Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mixed type properties for DIDs and VCs #109

Open
1 task done
KendallWeihe opened this issue Mar 15, 2024 · 1 comment
Open
1 task done

Mixed type properties for DIDs and VCs #109

KendallWeihe opened this issue Mar 15, 2024 · 1 comment

Comments

@KendallWeihe
Copy link
Contributor

KendallWeihe commented Mar 15, 2024

This ticket will take the place of the following

Also relevant as a source of inspiration for this work is this PR #104


The source of truth as to what web5 will support is codified in the web5-spec repo, and initially created within this PR.

The requirements are as follows:

  • Implement support for the types defined in the web5-spec repo (at the time of this ticket, that'll be, DIDs and VCs)
  • During deserialization of a type, given the string/byte-array/whatever which is being deserialized has a property type which is different than what we have defined in the web5-spec repo, then throw an exception
    • Consider if JSON Schemas can be used prior-to or during deserialization as a mechanism of implementing this expected behavior (web5-spec issue for tracking) -- rather than writing custom JSON unmarshallers, perhaps we could validate the type with a single JSON Schema validation call

Note: the only mixed type I see at this time is the issuer in the VC Data Model. As for how we will implement a mixed type here in golang, we do not have a set consensus, but have two separate proposals:

  1. Rely on the caller to perform type assertions; From this PR notice the dids/didcore/document_test.go or dids/didcore/examples_test.go as a reference example
  2. @alecthomas made a separate proposal which is self-evident in his comment here

This work may prove too unwieldy for a single PR, if so then piece meal PRs are appropriate

@KendallWeihe
Copy link
Contributor Author

We should use the JSON schema to enforce existence requirements, so no need to write custom json marshallers/unmarshallers in this work. Wrote a new ticket for JSON Schema validation #131

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

No branches or pull requests

1 participant