Skip to content

Instantly share code, notes, and snippets.

@zaun
Last active September 8, 2018 18:51
Show Gist options
  • Save zaun/8d758a60ee0631bad0a2414e0d7ca39c to your computer and use it in GitHub Desktop.
Save zaun/8d758a60ee0631bad0a2414e0d7ca39c to your computer and use it in GitHub Desktop.
Schemas for data
{
"id": "Location#",
"title": "Location Schema",
"description": "A location",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "UUID v4 with 'L-' prefix",
"pattern": "/^L-[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/i"
},
"parent": {
"type": "string",
"description": "UUID v4 with 'L-' prefix",
"pattern": "/^L-[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/i"
},
"name": {
"type": "string"
},
"abbreviation": {
"type": "string"
},
"type": {
"type": "string",
"enum": [ "Country", "State", "County", "District", "City", "Territory" ]
},
"capital": { "$ref": "LocationLink#" },
"established": {
"type": "string",
"format": "date"
},
"totalAreaKM": {
"type": "number"
},
"landAreaKM": {
"type": "number"
},
"waterAreaKM": {
"type": "number"
},
"waterAreaKM": {
"type": "number"
},
"geoPoint": {
"type": "object",
"properties": {
"latitude": {
"type": "number"
},
"longitude": {
"type": "number"
}
},
"additionalProperties": false
},
"geoBounds": {
"type": "object",
"properties": {
"topLeft": {
"type": "object",
"properties": {
"latitude": {
"type": "number"
},
"longitude": {
"type": "number"
}
},
"additionalProperties": false
},
"topRight": {
"type": "object",
"properties": {
"latitude": {
"type": "number"
},
"longitude": {
"type": "number"
}
},
"additionalProperties": false
},
"bottomLeft": {
"type": "object",
"properties": {
"latitude": {
"type": "number"
},
"longitude": {
"type": "number"
}
},
"additionalProperties": false
},
"bottomRight": {
"type": "object",
"properties": {
"latitude": {
"type": "number"
},
"longitude": {
"type": "number"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
"mottos": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"category": {
"type": "string"
},
"primary": {
"type": "boolean"
}
},
"required": ["name"]
}
},
"flowers": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"category": {
"type": "string"
},
"primary": {
"type": "boolean"
}
},
"required": ["name"]
}
},
"birds": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"category": {
"type": "string"
},
"primary": {
"type": "boolean"
}
},
"required": ["name"]
}
},
"trees": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"category": {
"type": "string"
},
"primary": {
"type": "boolean"
}
},
"required": ["name"]
}
},
"songs": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"category": {
"type": "string"
},
"primary": {
"type": "boolean"
}
},
"required": ["name"]
}
},
"population": {
"type": "array",
"items": {
"type": "object",
"properties": {
"year": {
"type": "number"
},
"total": {
"type": "number"
},
"males": {
"type": "number"
},
"females": {
"type": "number"
},
"births": {
"type": "number"
},
"deaths": {
"type": "number"
}
}
}
}
},
"required": ["id"],
"additionalProperties": false
}
{
"id": "Person#",
"title": "Person Schema",
"description": "A person",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "UUID v4 with 'P-' prefix",
"pattern": "/^P-[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/i"
},
"firstName": {
"type": "string"
},
"middleName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"maidenName": {
"type": "string"
},
"suffix": {
"type": "string"
},
"nickname": {
"type": "string"
},
"gender": {
"type": "string",
"enum": ["male", "female", "unknown"],
"default": "unknown"
},
"abstract": {
"description": "A description of the person 5-7 sentences in length.",
"type": "string"
},
"birth": {
"date": {
"type": "string",
"pattern": "/^\\d{4}-\\d{2}-\\d{2}$/i"
},
"country": {"$ref": "LocationLink#"},
"region": {"$ref": "LocationLink#"}
},
"death": {
"date": {
"type": "string",
"pattern": "/^\\d{4}-\\d{2}-\\d{2}$/i"
},
"country": {"$ref": "LocationLink#"},
"region": {"$ref": "LocationLink#"},
"obituaries": {
"type": "array",
"items": {
"type": "string"
},
"uniqueItems": true
}
},
"mother": { "$ref": "PersonLink#" },
"father": { "$ref": "PersonLink#" },
"spouses": {
"type": "array",
"items": { "$ref": "PersonLink#" },
"uniqueItems": true
},
"children": {
"type": "array",
"items": { "$ref": "PersonLink#" },
"uniqueItems": true
},
"politicalTerms": {
"type": "array",
"items": {
"title": "Political Term",
"type": "object",
"properties": {
"position": {
"type": "string"
},
"title": {
"type": "string"
},
"startDate": {
"type": "string",
"pattern": "/^\\d{4}-\\d{2}-\\d{2}$/i"
},
"endDate": {
"type": "string",
"pattern": "/^\\d{4}-\\d{2}-\\d{2}$/i"
},
"politicalParty": {
"type": "string",
"enum": ["unknown", "democrate", "republican"],
"default": "unknown"
}
},
"additionalProperties": false
},
"uniqueItems": true
}
},
"required": ["id"],
"additionalProperties": false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment