Introducing
Your new presentation assistant.
Refine, enhance, and tailor your content, source relevant images, and edit visuals quicker than ever before.
Trending searches
JSON-schema is a way to describe the structure of documents in JSON, constraining what values their properties may take.
{
"@context": {
"uid": {"@id": "https://openbadges.org/1.1/standard#uid", "@type": "@id"},
. . .
"validation": {
"schema": "https://openbadges.org/1.1/schema"
}
}
}
{
"@context": [
"https://openbadges.org/1.1/context",
{"newextension: "https://example.org/new-ext-info" }
],
"newextension": {
"@context": "http://example.org/new-ext-context"
"newProperty":"special value",
"otherProperty": 12
},
"uid": "f2c20", . . .
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Open Badges Assertion",
"description": "A document that describes an Open Badge instance, as issued to one earner",
"type": "object",
"id": "http://openbadges.org/1.1/schema/assertion",
"definitions": { . . .
Error: "otherProperty is outside the acceptable range, according to newextension's validation schema:
"otherProperty": { "type": "integer", "minimum": 42 }
{
"@context": {
"newProperty": {"@id": "http://example.org/newProp-definition", "@type": "@id"},
"otherProperty": {"@id": "http://schema.org/Number", "@type": "@id"},
. . .
"validation": {"schema": "https://example.org/new-ext-schema" }
}
}
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "New Extension",
"description": "A set of new properties to add to an Open Badge",
"type": "object",
"properties": {
"newProperty": { "type": "string" },
"otherProperty": { "type": "integer", "minimum": 42 }
}
}
These definitions and constraints would apply only within the extension object.
And you could see if the issuer extended the badge correctly by validating the extension part of the badge against the schema
These IRIs (usually equivalent to URIs) correspond to where definitions of each term are available.
{
"@context": {
"uid": {"@id": "https://openbadges.org/1.1/standard#uid", "@type": "@id"},
"recipient": {"@id": "https://openbadges.org/1.1/standard#recipient", "@type": "@id"},
"issuedOn": {"@id": "https://openbadges.org/1.1/standard#issueDate", "@type": "@id"},
"expires": {"@id": "https://openbadges.org/1.1/standard#expirationDate", "@type": "@id"},
"evidence": {"@id": "https://openbadges.org/1.1/standard#evidence", "@type": "@id"} . . .
This means the assertion's property "uid" is defined at "https://openbadges.org/1.1/standard#uid" and the value of that property in the assertion is of the type described there.
We can define new properties a similar way, by adding context for them. For an extension object:
{
"@context": [
"https://openbadges.org/1.1/context",
{"newextension: "https://example.org/new-ext-info" }
],
"newextension": {
"@context": "http://example.org/new-ext-context"
"newProperty":"special value",
"otherProperty": 1239
},
"uid": "f2c20", . . .
There are some advantages to extending with an object, but maybe we could define a similar way, by adding context for them. I don't like this as much...
{
"@context": [
"https://openbadges.org/1.1/context",
{"newProperty: { "@id":"https://example.org/new-
property-definition", "@type": "@id" }
],
"newProperty":"special value",
"uid": "f2c20", . . .
This linked context doc defines "newProperty" and "otherProperty"
Badge Objects contain a @context property that maps property names to the definitions of those properties.
{
"@context": "https://openbadges.org/1.1/context"
"uid": "f2c20",
"recipient": {
"type": "email",
"hashed": true,
"salt": "deadsea",
"identity": "sha256$c7ef86405ba71b85acd8e2e95166c4b111448089f2e1599f42fe1bba46e865c5"
}, . . .