Minor change in JSON schema doesn't validate calculate ?
See original GitHub issueHi
I’m struggling with a strange bug.
My code :
const schema2 = {
"$schema": "http://json-schema.org/draft-07/schema",
"description": "An abstract digital asset schema.",
"properties": {
"$evidence": {
"description": "A URI pointing to the evidence JSON with data needed to certify this asset.",
"type": "string"
},
"$schema": {
"description": "A path to JSON Schema definition file.",
"type": "string"
},
"name": {
"description": "A property that holds a name of an asset.",
"type": "string"
},
"description": {
"description": "A property that holds a detailed description of an asset.",
"type": "string"
},
"image": {
"description": "A public property that can be a valid URI pointing to a resource with mime type image/* representing the asset to which this digital assets represents. Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive.",
"type": "string"
},
"pictures" : {
"type": "array",
"title": "Pictures",
"items":
{
"type": "object",
"properties": {
"src": {
"type": "string",
"title": "Picture URL",
"description": "url",
}
}
}
},
},
"title": "Asset",
"type": "object",
"required": ["$schema"]
};
const cert2 = new Cert({ schema: schema2 });
const data2 = {
"$evidence": "https://troopersgame.com/dog/evidence.json",
"$schema": "https://conventions.0xcert.org/86-base-asset-schema.json",
"description": "A weapon for the Troopers game which can severely injure the enemy.",
"name": "Magic Sword"
};
var certif2 = await cert2.imprint(data2);
console.log('Ximprint',certif2);
const proofs2 = await cert2.notarize(data2);
console.log('Xproofs',proofs2)
// calculate imprint
const imprint2_test = await cert2.calculate(data2, proofs2);
console.log('Ximprint2',imprint2_test);
Console output : Ximprint 0d8e73fbf5f687cad2202ea112a05067273fd65509e721ef1e7cb76bc0d76966 Xproofs [{…}] Ximprint2 0d8e73fbf5f687cad2202ea112a05067273fd65509e721ef1e7cb76bc0d76966 ==> Same imprint, Good !
If I change the schema from “pictures” to something else for the last element, it validates only with random change
pictures => externalContent : not ok pictures => picture : ok pictures => pict : ok pictures => picturesExternal : ok pictures => ppicturesExternal : ok pictures => ext : not ok pictures => extpic : not ok pictures => picext : ok pictures => picturespictures : ok pictures => serutcip : ok pictures => p : ok pictures => e : not ok pictures => a : not ok pictures => b : not ok pictures => s : ok
I really really don’t understand what I’m missing here … of course, it will be something very simple 😃
Also, it seems that if element start with “e” it’s not working ?
Thanks !
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (5 by maintainers)
Top GitHub Comments
Thanks ! I really prefer using OxCert to have a nice imprint versus a simple hash function (and of course producthunt upvoted 😃 )
Reference: this is shipped in https://github.com/0xcert/framework/releases/tag/1.5.0