From d90f80ce96410e1a75dc26cc9961e98a66d8f0cf Mon Sep 17 00:00:00 2001 From: kts of kettek Date: Wed, 22 Feb 2017 00:21:07 -0800 Subject: [PATCH] Add initial JSON schema for nutriman data --- schema.json | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 schema.json diff --git a/schema.json b/schema.json new file mode 100644 index 0000000..fcfc934 --- /dev/null +++ b/schema.json @@ -0,0 +1,125 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + + "definitions": { + "reference": { + "title": "Reference", + "description": "A reference", + "type": "object", + "properties": { + "id": { + "title": "Identifier", + "description": "The unique identifier for the reference", + "type": "string" + }, + "name": { + "title": "Name", + "description": "The name of the reference", + "type": "string" + }, + "source": { + "title": "Source", + "description": "The source of the reference, such as a URL", + "type": "string" + } + } + }, + + "mineral": { + "title": "Mineral", + "description": "A Mineral Entry for Nutriman", + "type": "object", + "properties": { + "name": { + "title": "Name", + "description": "Name of the mineral", + "type": "string" + }, + "rda": { + "type": "object", + "title": "Allowance", + "properties": { + "amount": { + "title": "Amount", + "description": "The amount of the RDA", + "type": "string" + }, + "ref": { + "title": "Reference", + "description": "The reference id of the allowance", + "type": "string" + } + } + } + }, + "required": ["name", "rda"] + }, + + "vitamin": { + "title": "Vitamin", + "description": "A Vitamin Entry for Nutriman", + "type": "object", + "properties": { + "names": { + "title": "Names", + "description": "Names of the vitamin, first entry is the primary name", + "type": "array", + "items": { + "type": "string", + "title": "Name" + }, + "uniqueItems": true, + "minItems": 1 + }, + "rda": { + "type": "object", + "title": "Allowance", + "properties": { + "amount": { + "title": "Amount", + "description": "The amount of the RDA", + "type": "string" + }, + "ref": { + "title": "Reference", + "description": "The reference id of the allowance", + "type": "string" + } + } + } + }, + "required": ["names", "rda"] + } + }, + "title": "Nutritional Data Sheet", + "properties": { + "vitamins": { + "title": "Vitamins", + "description": "A list of all vitamins", + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/vitamin" + } + }, + "minerals": { + "title": "Minerals", + "description": "A list of all minerals", + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/mineral" + } + }, + "references": { + "title": "References", + "description": "An array of references for RDAs, UILs, and similar", + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/reference" + }, + "required": ["id", "name", "source"] + } + } +}