{"__v":11,"_id":"562d247e26a0a10d00ad6bfe","category":{"__v":1,"_id":"562d247b26a0a10d00ad6be7","pages":["562d247e26a0a10d00ad6bfc","562d247e26a0a10d00ad6bfd","562d247e26a0a10d00ad6bfe","562d247e26a0a10d00ad6bff","562d247e26a0a10d00ad6c00","562d247e26a0a10d00ad6c01","562d247e26a0a10d00ad6c02","562d247e26a0a10d00ad6c03","562d247e26a0a10d00ad6c04"],"project":"55ba86e68f4ef01900c0ae1f","version":"562d247a26a0a10d00ad6be2","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-07-30T22:45:50.984Z","from_sync":false,"order":7,"slug":"autocode-elements","title":"Hacking Autocode"},"project":"55ba86e68f4ef01900c0ae1f","user":"55ba86a810133e2b00feb6bc","version":{"__v":10,"_id":"562d247a26a0a10d00ad6be2","project":"55ba86e68f4ef01900c0ae1f","createdAt":"2015-10-25T18:50:34.678Z","releaseDate":"2015-10-25T18:50:34.678Z","categories":["562d247b26a0a10d00ad6be3","562d247b26a0a10d00ad6be4","562d247b26a0a10d00ad6be5","562d247b26a0a10d00ad6be6","562d247b26a0a10d00ad6be7","562d247b26a0a10d00ad6be8","562d247b26a0a10d00ad6be9","566f8106f11d5a0d007226fa","566fb8be1dabd80d00b1206c","566fb8c4cbb2fb0d00f7c4c0","566fb8c9e10ecb0d0004edd0","566fb8ea6995210d003aaa65","566fb8fce10ecb0d0004edd1","566fb901e10ecb0d0004edd2","566fb90e81801f0d00802d60","566fb9126995210d003aaa66"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-07-30T22:47:29.135Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"Schemas are used to determine structure and validation of [Specs](doc:specs).\n\nThey are written in YAML and uses JSON Schema Draft 4.\n\n## Export a Schema\n\nTo create a Schema, go to **Exports** and click **Add Export**:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/9tLINqSQ5KDmDtuTdEbW_Screen%20Shot%202015-12-15%20at%2012.40.28%20AM.png\",\n        \"Screen Shot 2015-12-15 at 12.40.28 AM.png\",\n        \"2560\",\n        \"1600\",\n        \"#8a4630\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nEnter a **Name** and **Description** and choose \"Schema\" as the **Type**.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/YCGuVkTpWEEWceFe7eAQ_Screen%20Shot%202015-12-15%20at%2012.43.08%20AM.png\",\n        \"Screen Shot 2015-12-15 at 12.43.08 AM.png\",\n        \"2560\",\n        \"1600\",\n        \"#5275bf\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nThen enter a schema you'd like to use. Here is an example for a blog:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"type: object\\nproperties:\\n  models:\\n    posts:\\n      attributes:\\n        publishedAt:\\n          type: date\\n    users:\\n      attributes:\\n        email:\\n          required: true\\n          type: string\\n        username:\\n          required: true\\n          type: string\",\n      \"language\": \"yaml\"\n    }\n  ]\n}\n[/block]\n## Example\n\nHere is what a schema looks like:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"type: object\\nproperties:\\n  name:\\n    required: true\\n  \\ttype: string\",\n      \"language\": \"yaml\"\n    }\n  ]\n}\n[/block]","excerpt":"Validate your specifications.","slug":"schemas","type":"basic","title":"Schemas"}

Schemas

Validate your specifications.

Schemas are used to determine structure and validation of [Specs](doc:specs). They are written in YAML and uses JSON Schema Draft 4. ## Export a Schema To create a Schema, go to **Exports** and click **Add Export**: [block:image] { "images": [ { "image": [ "https://files.readme.io/9tLINqSQ5KDmDtuTdEbW_Screen%20Shot%202015-12-15%20at%2012.40.28%20AM.png", "Screen Shot 2015-12-15 at 12.40.28 AM.png", "2560", "1600", "#8a4630", "" ] } ] } [/block] Enter a **Name** and **Description** and choose "Schema" as the **Type**. [block:image] { "images": [ { "image": [ "https://files.readme.io/YCGuVkTpWEEWceFe7eAQ_Screen%20Shot%202015-12-15%20at%2012.43.08%20AM.png", "Screen Shot 2015-12-15 at 12.43.08 AM.png", "2560", "1600", "#5275bf", "" ] } ] } [/block] Then enter a schema you'd like to use. Here is an example for a blog: [block:code] { "codes": [ { "code": "type: object\nproperties:\n models:\n posts:\n attributes:\n publishedAt:\n type: date\n users:\n attributes:\n email:\n required: true\n type: string\n username:\n required: true\n type: string", "language": "yaml" } ] } [/block] ## Example Here is what a schema looks like: [block:code] { "codes": [ { "code": "type: object\nproperties:\n name:\n required: true\n \ttype: string", "language": "yaml" } ] } [/block]