| -- basic.json -- |
| { |
| "$schema": "http://json-schema.org/draft-07/schema#", |
| |
| "type": "object", |
| "title": "Main schema", |
| "description": "Specify who you are and all.", |
| |
| "properties": { |
| "person": { |
| "description": "A person is a human being.", |
| "type": "object", |
| "required": [ "name" ], |
| "properties": { |
| "name": { |
| "type": "string", |
| "examples": [ "foo" ] |
| }, |
| "address": { |
| "description": "where does this person live?", |
| "type": "string", |
| "minLength": 4, |
| "maxLength": 20 |
| }, |
| "children": { |
| "description": "A very large comment that will be wrapped after a certain line length. Let's keep on going and see what happens.", |
| "type": "array", |
| "items": { "type": "string" }, |
| "default": [] |
| }, |
| "home phone": { |
| "type": "string", |
| "deprecated": true |
| } |
| } |
| } |
| } |
| } |
| |
| -- out.cue -- |
| import "strings" |
| |
| // Main schema |
| // |
| // Specify who you are and all. |
| @jsonschema(schema="http://json-schema.org/draft-07/schema#") |
| |
| // A person is a human being. |
| person?: { |
| name: string |
| |
| // where does this person live? |
| address?: strings.MinRunes(4) & strings.MaxRunes(20) |
| |
| // A very large comment that will be wrapped after a certain line |
| // length. Let's keep on going and see what happens. |
| children?: [...string] |
| "home phone"?: string @deprecated() |
| ... |
| } |
| ... |