Function validate_json_compliance

Source
pub fn validate_json_compliance(json: &Value) -> bool
Expand description

This function ensures the contents of a JSON file are compliant with the Off-Chain Shadow Standard which we define as a JSON with the non-null values for the following fields:

  1. name: Name of the asset.
  2. symbol: Symbol of the asset.
  3. description: Description of the asset.
  4. image: URI pointing to the asset’s logo.
  5. external_url: URI pointing to an external URL defining the asset — e.g. the game’s main site.

The function simply checks whether these fields are non-null. Although we do not check for it, we recommend the following fields are included if relevant:

  1. animation_url (optional): URI pointing to the asset’s animation.
  2. attributes (optional): Array of attributes defining the characteristics of the asset. a) trait_type: The type of attribute. b) value: The value for that attribute.