Common Schema Use Cases
Here are some popular schema types you might create:
Membership Points Schema
A comprehensive example showing how to create a schema for tracking membership points and tiers.
JSON-LD Context
json
{
"@context": [
{
"@version": 1.1,
"@protected": true,
"id": "@id",
"type": "@type",
"MembershipPointsCredential": {
"@id": "https://your-domain.com/schemas/membership-points.json-ld#MembershipPointsCredential",
"@context": {
"@version": 1.1,
"@protected": true,
"id": "@id",
"type": "@type",
"vocab": "https://your-domain.com/vocab/membership-points#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"memberId": {
"@id": "vocab:memberId",
"@type": "xsd:string"
},
"totalPoints": {
"@id": "vocab:totalPoints",
"@type": "xsd:integer"
},
"tier": {
"@id": "vocab:tier",
"@type": "xsd:string"
},
"lastUpdated": {
"@id": "vocab:lastUpdated",
"@type": "xsd:dateTime"
}
}
}
}
]
}
JSON Schema
json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"$metadata": {
"uris": {
"jsonLdContext": "https://your-domain.com/schemas/membership-points.json-ld",
"jsonSchema": "https://your-domain.com/schemas/membership-points.json"
}
},
"required": [
"@context",
"id",
"type",
"issuanceDate",
"credentialSubject",
"credentialSchema",
"credentialStatus",
"issuer"
],
"properties": {
"@context": {
"type": ["string", "array", "object"]
},
"id": {
"type": "string"
},
"type": {
"type": ["string", "array"],
"items": {
"type": "string"
}
},
"issuer": {
"type": ["string", "object"],
"format": "uri",
"required": ["id"],
"properties": {
"id": {
"type": "string",
"format": "uri"
}
}
},
"issuanceDate": {
"type": "string",
"format": "date-time"
},
"expirationDate": {
"type": "string",
"format": "date-time"
},
"credentialSchema": {
"type": "object",
"required": ["id", "type"],
"properties": {
"id": {
"type": "string",
"format": "uri"
},
"type": {
"type": "string"
}
}
},
"credentialSubject": {
"type": "object",
"required": ["id", "memberId", "totalPoints", "tier"],
"properties": {
"id": {
"title": "Credential Subject ID",
"type": "string",
"format": "uri"
},
"memberId": {
"title": "Member ID",
"type": "string",
"description": "Unique member identifier"
},
"totalPoints": {
"title": "Total Points",
"type": "integer",
"description": "Total accumulated membership points",
"minimum": 0
},
"tier": {
"title": "Membership Tier",
"type": "string",
"description": "Current membership tier based on points",
"enum": ["bronze", "silver", "gold", "platinum"]
},
"lastUpdated": {
"title": "Last Updated",
"type": "string",
"format": "date-time",
"description": "When points were last updated"
}
}
}
}
}
Age Verification Schema
JSON-LD Context
json
{
"@context": [
{
"@version": 1.1,
"@protected": true,
"id": "@id",
"type": "@type",
"AgeVerificationCredential": {
"@id": "https://your-domain.com/schemas/age-verification.json-ld#AgeVerificationCredential",
"@context": {
"@version": 1.1,
"@protected": true,
"id": "@id",
"type": "@type",
"vocab": "https://your-domain.com/vocab/age-verification#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"age": {
"@id": "vocab:age",
"@type": "xsd:integer"
},
"dateOfBirth": {
"@id": "vocab:dateOfBirth",
"@type": "xsd:date"
},
"jurisdiction": {
"@id": "vocab:jurisdiction",
"@type": "xsd:string"
}
}
}
}
]
}
JSON Schema
json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"$metadata": {
"uris": {
"jsonLdContext": "https://your-domain.com/schemas/age-verification.json-ld",
"jsonSchema": "https://your-domain.com/schemas/age-verification.json"
}
},
"required": [
"@context",
"id",
"type",
"issuanceDate",
"credentialSubject",
"credentialSchema",
"credentialStatus",
"issuer"
],
"properties": {
"@context": {
"type": ["string", "array", "object"]
},
"id": {
"type": "string"
},
"type": {
"type": ["string", "array"],
"items": {
"type": "string"
}
},
"issuer": {
"type": ["string", "object"],
"format": "uri",
"required": ["id"],
"properties": {
"id": {
"type": "string",
"format": "uri"
}
}
},
"issuanceDate": {
"type": "string",
"format": "date-time"
},
"expirationDate": {
"type": "string",
"format": "date-time"
},
"credentialSchema": {
"type": "object",
"required": ["id", "type"],
"properties": {
"id": {
"type": "string",
"format": "uri"
},
"type": {
"type": "string"
}
}
},
"credentialSubject": {
"type": "object",
"required": ["id", "age", "dateOfBirth", "jurisdiction"],
"properties": {
"id": {
"title": "Credential Subject ID",
"type": "string",
"format": "uri"
},
"age": {
"title": "Age",
"type": "integer",
"description": "User's age in years",
"minimum": 0,
"maximum": 150
},
"dateOfBirth": {
"title": "Date of Birth",
"type": "string",
"format": "date",
"description": "User's date of birth"
},
"jurisdiction": {
"title": "Jurisdiction",
"type": "string",
"description": "Legal jurisdiction for age verification"
}
}
}
}
}
Event Pass Schema
JSON-LD Context
json
{
"@context": [
{
"@version": 1.1,
"@protected": true,
"id": "@id",
"type": "@type",
"EventPassCredential": {
"@id": "https://your-domain.com/schemas/event-pass.json-ld#EventPassCredential",
"@context": {
"@version": 1.1,
"@protected": true,
"id": "@id",
"type": "@type",
"vocab": "https://your-domain.com/vocab/event-pass#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"eventName": {
"@id": "vocab:eventName",
"@type": "xsd:string"
},
"eventDate": {
"@id": "vocab:eventDate",
"@type": "xsd:dateTime"
},
"ticketType": {
"@id": "vocab:ticketType",
"@type": "xsd:string"
},
"seatNumber": {
"@id": "vocab:seatNumber",
"@type": "xsd:string"
}
}
}
}
]
}
JSON Schema
json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"$metadata": {
"uris": {
"jsonLdContext": "https://your-domain.com/schemas/event-pass.json-ld",
"jsonSchema": "https://your-domain.com/schemas/event-pass.json"
}
},
"required": [
"@context",
"id",
"type",
"issuanceDate",
"credentialSubject",
"credentialSchema",
"credentialStatus",
"issuer"
],
"properties": {
"@context": {
"type": ["string", "array", "object"]
},
"id": {
"type": "string"
},
"type": {
"type": ["string", "array"],
"items": {
"type": "string"
}
},
"issuer": {
"type": ["string", "object"],
"format": "uri",
"required": ["id"],
"properties": {
"id": {
"type": "string",
"format": "uri"
}
}
},
"issuanceDate": {
"type": "string",
"format": "date-time"
},
"expirationDate": {
"type": "string",
"format": "date-time"
},
"credentialSchema": {
"type": "object",
"required": ["id", "type"],
"properties": {
"id": {
"type": "string",
"format": "uri"
},
"type": {
"type": "string"
}
}
},
"credentialSubject": {
"type": "object",
"required": ["id", "eventName", "eventDate", "ticketType"],
"properties": {
"id": {
"title": "Credential Subject ID",
"type": "string",
"format": "uri"
},
"eventName": {
"title": "Event Name",
"type": "string",
"description": "Name of the event"
},
"eventDate": {
"title": "Event Date",
"type": "string",
"format": "date-time",
"description": "Date and time of the event"
},
"ticketType": {
"title": "Ticket Type",
"type": "string",
"description": "Type of ticket",
"enum": ["general", "vip", "backstage", "premium"]
},
"seatNumber": {
"title": "Seat Number",
"type": "string",
"description": "Seat or section number"
}
}
}
}
}
Professional Credential Schema
JSON-LD Context
json
{
"@context": [
{
"@version": 1.1,
"@protected": true,
"id": "@id",
"type": "@type",
"ProfessionalCredential": {
"@id": "https://your-domain.com/schemas/professional-credential.json-ld#ProfessionalCredential",
"@context": {
"@version": 1.1,
"@protected": true,
"id": "@id",
"type": "@type",
"vocab": "https://your-domain.com/vocab/professional-credential#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"certificationName": {
"@id": "vocab:certificationName",
"@type": "xsd:string"
},
"issuingOrganization": {
"@id": "vocab:issuingOrganization",
"@type": "xsd:string"
},
"certificationNumber": {
"@id": "vocab:certificationNumber",
"@type": "xsd:string"
},
"issueDate": {
"@id": "vocab:issueDate",
"@type": "xsd:date"
},
"expiryDate": {
"@id": "vocab:expiryDate",
"@type": "xsd:date"
},
"credentialLevel": {
"@id": "vocab:credentialLevel",
"@type": "xsd:string"
}
}
}
}
]
}
JSON Schema
json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"$metadata": {
"uris": {
"jsonLdContext": "https://your-domain.com/schemas/professional-credential.json-ld",
"jsonSchema": "https://your-domain.com/schemas/professional-credential.json"
}
},
"required": [
"@context",
"id",
"type",
"issuanceDate",
"credentialSubject",
"credentialSchema",
"credentialStatus",
"issuer"
],
"properties": {
"@context": {
"type": ["string", "array", "object"]
},
"id": {
"type": "string"
},
"type": {
"type": ["string", "array"],
"items": {
"type": "string"
}
},
"issuer": {
"type": ["string", "object"],
"format": "uri",
"required": ["id"],
"properties": {
"id": {
"type": "string",
"format": "uri"
}
}
},
"issuanceDate": {
"type": "string",
"format": "date-time"
},
"expirationDate": {
"type": "string",
"format": "date-time"
},
"credentialSchema": {
"type": "object",
"required": ["id", "type"],
"properties": {
"id": {
"type": "string",
"format": "uri"
},
"type": {
"type": "string"
}
}
},
"credentialSubject": {
"type": "object",
"required": [
"id",
"certificationName",
"issuingOrganization",
"certificationNumber",
"issueDate"
],
"properties": {
"id": {
"title": "Credential Subject ID",
"type": "string",
"format": "uri"
},
"certificationName": {
"title": "Certification Name",
"type": "string",
"description": "Name of the certification"
},
"issuingOrganization": {
"title": "Issuing Organization",
"type": "string",
"description": "Organization that issued the certification"
},
"certificationNumber": {
"title": "Certification Number",
"type": "string",
"description": "Unique certification identifier"
},
"issueDate": {
"title": "Issue Date",
"type": "string",
"format": "date",
"description": "Date the certification was issued"
},
"expiryDate": {
"title": "Expiry Date",
"type": "string",
"format": "date",
"description": "Date the certification expires"
},
"credentialLevel": {
"title": "Credential Level",
"type": "string",
"description": "Level of certification",
"enum": ["associate", "professional", "expert", "master"]
}
}
}
}
}