Skip to content

Commit

Permalink
Add omitempty to vc.Proof tag (#120)
Browse files Browse the repository at this point in the history
* Add omitempty to vc.Proof tag

* update test
  • Loading branch information
gerardsn authored Oct 16, 2024
1 parent 008453a commit 668490f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion vc/vc.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ type VerifiableCredential struct {
// CredentialSubject holds the actual data for the credential. It must be extracted using the UnmarshalCredentialSubject method and a custom type.
CredentialSubject []interface{} `json:"credentialSubject"`
// Proof contains the cryptographic proof(s). It must be extracted using the Proofs method or UnmarshalProofValue method for non-generic proof fields.
Proof []interface{} `json:"proof"`
Proof []interface{} `json:"proof,omitempty"`

format string
raw string
Expand Down
2 changes: 1 addition & 1 deletion vc/vc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func TestVerifiableCredential_JSONMarshalling(t *testing.T) {
input := VerifiableCredential{}
actual, err := json.Marshal(input)
require.NoError(t, err)
const expected = "{\"@context\":null,\"credentialSubject\":null,\"issuanceDate\":\"0001-01-01T00:00:00Z\",\"issuer\":\"\",\"proof\":null,\"type\":null}"
const expected = "{\"@context\":null,\"credentialSubject\":null,\"issuanceDate\":\"0001-01-01T00:00:00Z\",\"issuer\":\"\",\"type\":null}"
assert.JSONEq(t, expected, string(actual))
})
})
Expand Down

0 comments on commit 668490f

Please sign in to comment.