question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Minor change in JSON schema doesn't validate calculate ?

See original GitHub issue

Hi

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:closed
  • Created 4 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
gnarcocommented, Apr 24, 2019

Thanks ! I really prefer using OxCert to have a nice imprint versus a simple hash function (and of course producthunt upvoted 😃 )

0reactions
fulldecentcommented, May 3, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cant validate children json-schema - Stack Overflow
When you declare the "children" property you are saying it's a "stdItem" , so it expects there to have the stdAttributes and stdType...
Read more >
A Vocabulary for Structural Validation of JSON - JSON Schema
Validation of Numeric Instances. The JSON specification allows numbers with arbitrary precision, and JSON Schema does not add any such bounds.
Read more >
Understanding JSON Schema
JSON Schema is a powerful tool for validating the structure of JSON data. However, learning to use it by reading its.
Read more >
A Vocabulary for Structural Validation of JSON - JSON Schema
JSON Schema (application/schema+json) has several purposes, one of which is JSON instance validation. This document specifies a vocabulary for JSON Schema ...
Read more >
It all starts with applicability - JSON Schema Fundamentals ...
The validation process for JSON Schema begins with applying the whole JSON Schema to the whole instance. The result of this application (Schema ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found