How to add custom additional fields - BlockcertValidationError

Hi Uzu,
Yes, that’s exactly right. Each of your new terms has to be defined in a JSON-LD context. You can either point to an existing JSON-LD context, or embed them directly in the context of the certificate. For an example of the latter, see the JSON-LD specification section 3.1. In this case, the @context value would be an array listing the existing context links, and your new definition. Roughly like this:

{
  "@context": [
        "https://w3id.org/openbadges/v2",
        "https://w3id.org/blockcerts/v2",
        {
             "xyz_custom_field": "http://path/to/xyz_custom_field",
              ... // and all other custom fields
        }
    ]
}

This is a doc oversight, so I’m going to create an issue to fix this.

1 Like