Error codes
T001 - Missing VcContext
annotation on UDT definition
When you define a user-defined type (UDT), you must add a VcContext
annotation to the type. Without this annotation, the Truvity SDK can't recognize the type as a UDT.
The following examples show how to add the annotation in different languages.
- TypeScript
- Java
@VcContext({ name: 'SimpleCredential', namespace: 'https://example.com/credentials' })
class SimpleCredential {
@VcClaim
name!: string;
@VcClaim
age!: number;
}
@VcContext(name = "SimpleCredential", namespace = "https://example.com/credentials")
public static class SimpleCredential {
private Optional<sString> name;
private Optional<Integer> age;
}
Further reading: SDK quick start guide
T002 - Unexpected type in serialization or deserialization
This error occurs when the type of a value during serialization or deserialization doesn’t match the UDT definition.
When you serialize data, the error happens if a value doesn’t match the declared type in the UDT claim. To fix it, either update the source values to match the UDT definition or update the UDT definition to match the source values.
When you deserialize data, the error happens if you change a UDT definition in a backward-incompatible way and try to deserialize existing data.
For example, if you originally define a claim as an integer
and later change it to a string
, deserialization fails for existing data.
To fix this, either revert the backward-incompatible change or update the UDT definition to stay compatible with the stored data.
Further reading: Define credential schema using UDT