-
Notifications
You must be signed in to change notification settings - Fork 61
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
Fix/use option string as domain type #636
Conversation
270d184
to
a5d6ad3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There can be more than one value for the domain property, see the specification here:
If specified, the associated value MUST be either a string, or an unordered set of strings.
So Vec<String>
is correct, but the serialization when there is only one value is wrong. You can fix it using the value_or_array
serializer defined in the syntax
module of ssi-vc
crate like this:
#[serde(
with = "value_or_array",
skip_serializing_if = "Vec::is_empty"
)]
pub domains: Vec<String> // or &'a [String]
This way if the array contains only one item, this item will be serialized directly.
a5d6ad3
to
e083a31
Compare
Nice, this worked well! since ssi-vc depends on data-integrity, I copied the implementation and re-used it within the data-integrity crate. This branch is a bit of a misnomer, but the implementation is working in sprucekit mobile. |
e083a31
to
ae78231
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
I approved it, but please wait for the end of CI to be sure 😅 |
Signed-off-by: Ryan Tate <ryan.tate@spruceid.com>
ae78231
to
d00a3a1
Compare
Description
Changes
domains
to use aOption<String>
type instead ofVec<String>
. This was causing an error with vc playground verification.Other considerations
I've left the
domains
property as-is, but we should consider changing this value todomain
. WDYT @timothee-haudebourg ?Tested
Tested in sprucekit mobile.