Skip to content

Instantly share code, notes, and snippets.

@andrewhayward
Created October 30, 2013 14:40
Show Gist options
  • Save andrewhayward/7233791 to your computer and use it in GitHub Desktop.
Save andrewhayward/7233791 to your computer and use it in GitHub Desktop.
Various potential schema for badge indexing.
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Badge List",
"description": "An index of available Open Badge lists",
"type": "object",
"required": ["badgeindex"],
"additionalProperties": false,
"properties": {
"badgeindex": {
"description": "Container for a set of badge lists.",
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"title": "Badge List",
"description": "Container for the data needed to describe a badge list.",
"type": "object",
"required": ["location"],
"additionalProperties": false,
"properties": {
"location": {
"description": "The location URI of a badge list.",
"type": "string",
"format": "uri"
}
}
}
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://openbadges.org/schemas/1.0"
xmlns="http://openbadges.org/schemas/1.0"
elementFormDefault="qualified">
<xsd:annotation>
<xsd:documentation>
XML Schema for Badge List files.
Last Modifed 2013-08-01
</xsd:documentation>
</xsd:annotation>
<xsd:element name="badgeindex">
<xsd:annotation>
<xsd:documentation>
Container for a set of badge lists.
This is the root element of the XML file.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="badges" type="tBadges" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="tBadges">
<xsd:annotation>
<xsd:documentation>
Container for the data needed to describe a badge list.
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="location" type="tLocation"/>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="tLocation">
<xsd:annotation>
<xsd:documentation>
REQUIRED: The location URI of a badge list.
The URI must conform to RFC 2396 (http://www.ietf.org/rfc/rfc2396.txt).
</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:anyURI">
<xsd:minLength value="12"/>
<xsd:maxLength value="2048"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Badge List",
"description": "A list of available Open Badges",
"type": "object",
"required": ["badgelist"],
"additionalProperties": false,
"properties": {
"badgelist": {
"description": "Container for a set of badge elements.",
"type": "array",
"items": {
"title": "Badge",
"description": "Container for the data needed to describe a badge assertion to extract.",
"type": "object",
"required": ["location"],
"additionalProperties": false,
"properties": {
"location": {
"description": "The location URI of a badge assertion.",
"type": "string",
"format": "uri"
},
"priority": {
"description": "The priority of a particular badge relative to other badges on the same site.",
"type": "number",
"minimum": 0.0,
"maximum": 1.0
}
}
}
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://openbadges.org/schemas/0.1"
xmlns="http://schemas.openbadges.org/schemas/0.1"
elementFormDefault="qualified">
<xsd:annotation>
<xsd:documentation>
XML Schema for Badge List files.
Last Modifed 2013-08-01
</xsd:documentation>
</xsd:annotation>
<xsd:element name="badgelist">
<xsd:annotation>
<xsd:documentation>
Container for a set of badge elements.
This is the root element of the XML file.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="badge" type="tBadge" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="tBadge">
<xsd:annotation>
<xsd:documentation>
Container for the data needed to describe a badge assertion to extract.
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="location" type="tLocation"/>
<xsd:element name="priority" type="tPriority" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="tLocation">
<xsd:annotation>
<xsd:documentation>
REQUIRED: The location URI of a badge assertion.
The URI must conform to RFC 2396 (http://www.ietf.org/rfc/rfc2396.txt).
</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:anyURI">
<xsd:minLength value="12"/>
<xsd:maxLength value="2048"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tPriority">
<xsd:annotation>
<xsd:documentation>
OPTIONAL: The priority of a particular badge relative to other badges
on the same site. The value for this element is a number between
0.0 and 1.0 where 0.0 identifies the lowest priority badge(s).
The default priority of a badge is 0.5. Priority is used to select
between badges on your site. Setting a priority of 1.0 for all badges
will not help you, as the relative priority of badges on your site
is what will be considered.
</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:decimal">
<xsd:minInclusive value="0.0"/>
<xsd:maxInclusive value="1.0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment