dekts
March 13, 2020, 1:58pm
1
I’m getting the error while I’m going to verify it from web browser (https://www.blockcerts.org/ )
I have added the additional fields in the manner of below example:
additional_per_recipient_fields = {"fields": [{"path": "$.evidence","value": "*|EVIDENCE|*","csv_column": "evidence"}]}
In above json I have added multiple fields and yes if the title is more then one word then I used it as:
additional_per_recipient_fields = {"fields": [{"path": "$.evidence_title","value": "*|EVIDENCE_TITLE|*","csv_column": "evidence_title"}]}
Now can you please help me why I’m getting the error called:
Hi @dekts ,
JSONLD normalization is a process where the document is parsed against a context definition.
It’s being thrown here: https://github.com/blockchain-certificates/cert-verifier-js/blob/master/src/inspectors/computeLocalHash.js#L88
Basically what this is telling you is that you are using fields that are not defined by the @context
key of your certificate.
You could try and define the keys that you are adding in your document in the same fashion as what Learning Machine does:
"@context": [
"https://w3id.org/openbadges/v2",
"https://w3id.org/blockcerts/v2",
{
"metadataJson": {
"@id": "https://schemas.learningmachine.com/2017/blockcerts/metadata",
"@type": "https://schemas.learningmachine.com/2017/types/text/json"
},
"displayHtml": {
"@id": "https://schemas.learningmachine.com/2017/blockcerts/displayHtml",
"@type": "https://schemas.learningmachine.com/2017/types/text/html"
},
"nonce": {
"@id": "https://schemas.learningmachine.com/2017/blockcerts/nonce",
"@type": "https://schema.org/Text"
},
"universalIdentifier": {
"@id": "https://schemas.learningmachine.com/2017/blockcerts/identifier",
"@type": "https://schema.org/Text"
}
}
]
I believe this should fix the issue for you
dekts
March 19, 2020, 4:52am
3
Yes correct @lemoustachiste
I have defined the parameters in the additional_global_fields
Here is the example how I have added the parameteres which is added in the additional_per_recipient_fields
"fields": [
{
"path": "$.@context",
"value": [
"https://w3id.org/openbadges/v2",
"https://w3id.org/blockcerts/v2",
{
"displayHtml": {
"@id": "schema:description"
},
"xyz_name": {
"@id": "schema:description"
},
"abc_logo": {
"@id": "schema:description"
}
}
]
}
]
}
Many thanks @lemoustachiste
Cheers!
@lemoustachiste @dekts
I’m using the default values and still facing the same issue
The root cause of this is because you have a key in the document that is not pre-declared in the @context
object.
JSONLD normalization in that case does not understand what to do with that word, and Blockcerts does not hash it out in the final output.
To circumvent the error, you’ll need to define the the alumniOf
as part of your context, either inline as the example in Found unmapped fields during JSON-LD normalization - #2 by lemoustachiste , or bringing in another context which defines the key word.
Watch out though, using this context: https://www.w3.org/2018/credentials/examples/v1 has proven to break other parts of blockcerts hashing, so I would advise against using it.