decentralized-identity / decentralized-identity/web5-go

Use JSON Schemas to validate type property existence requirements

Open
#131 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
21
Forks
7
PR merge metrics
No merged PRs in 30d

Description

Created as a result of the work of https://github.com/TBD54566975/web5-go/issues/109

We have standardized DID and VC type requirements as defined [here](https://github.com/TBD54566975/web5-spec/blob/main/spec/did.md) and [here](https://github.com/TBD54566975/web5-spec/blob/main/spec/vc.md). And part of that standardization is a requirement for the _existence_ of some type properties. For example, a VC `issuanceDate` is always required to exist, but a VC `expirationDate` is not required to exist.

Let's use the JSON Schemas to enforce this requirement.

---

## Design proposal

Two possible approaches, and we could choose to do both

1. We could add functions specific to validating, which the consuming app is expected to call -- this would be useful given they already have the type instantiated and didn't use the json marshalling functionality
2. We could write custom json unmarshalling/marshalling functions (ex how we're doing this in `jwt/jwt.go` [here](https://github.com/TBD54566975/web5-go/blob/16aa6fd03c18edf83f359cf6db6b4235e33cab0b/jwt/jwt.go#L224)) -- this would be useful if they were unmarshalling/marshalling the data

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.