-
-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
TL;DR
I get this error when calling expand in a created document
Error: 0x16d831f98
Details
So I'm trying to expand a JSON-LD document that has no remote URL. This is the code that I have setup to do so:
let value = serde_json::to_value(credential).unwrap().to_string();
println!("{value}");
// Create a "remote" document by parsing a file manually.
let input = json_ld::RemoteDocument::new(
// We use `IriBuf` as IRI type.
None,
// Optional content type.
None,
// Parse the file.
json_ld::syntax::Value::parse_str(
value.as_str(),
|span| span, // keep the source `Span` of each element as metadata.
)
.expect("Error creating remote document"),
);
// Use `NoLoader` as we won't need to load any remote document.
let mut loader = json_ld::NoLoader::<_, _>::new();
// Expand the "remote" document.
let expanded = aw!(input.expand(&mut loader));
match expanded {
Err(e) => {
println!("Error: {:?}", e);
}
Ok(expanded) => {
for object in expanded.into_value() {
if let Some(id) = object.id() {
let name = object
.as_node()
.unwrap()
.get_any(&iri!("http://xmlns.com/foaf/0.1/name"))
.unwrap()
.as_str()
.unwrap();
println!("id: {id}");
println!("name: {name}");
}
}
}
}The value printed by the print statement is
{
"@context":[
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/traceability/v1"
],
"credentialSubject":{
"BIC11":"TDOMCATTTOR",
"accountId":"1111111",
"address":{
"addressCountry":"Canada",
"addressLocality":"Toronto",
"addressRegion":"ON",
"postalCode":"M3B 1A2",
"streetAddress":"19 Knox St",
"type":[
"PostalAddress"
]
},
"familyName":"Smith",
"givenName":"Alice",
"iban":"GB74GSLD04296280001319",
"id":"did:knox:z6Mk2cd21e9abe57fae7...31073da1b522790e63834fe17a4c2be",
"routingInfo":{
"code":"GBDSC",
"type":[
"RoutingInfo"
],
"value":"042962"
},
"type":[
"BankAccount"
]
},
"id":"12345",
"issuanceDate":"2023-01-11T23:33:55.316962+00:00",
"issuer":"did:test:z6MkncBtsFLzCQBzVFNAFkwbrerB4tGnX76S3hZKgd6ytz92",
"type":[
"VerifiableCredential",
"BankAccountCredential"
]
}
This JSON-LD document is processed perfectly fine by the JSON-LD playground but results in the following error when using this library:
Error: 0x16d831f98
Metadata
Metadata
Assignees
Labels
No labels