...

Text file src/cuelang.org/go/encoding/jsonschema/testdata/basic.txtar

Documentation: cuelang.org/go/encoding/jsonschema/testdata

     1-- basic.json --
     2{
     3  "$schema": "http://json-schema.org/draft-07/schema#",
     4
     5  "type": "object",
     6  "title": "Main schema",
     7  "description": "Specify who you are and all.",
     8
     9  "properties": {
    10    "person": {
    11      "description": "A person is a human being.",
    12      "type": "object",
    13      "required": [ "name" ],
    14      "properties": {
    15        "name": {
    16          "type": "string",
    17          "examples": [ "foo" ]
    18        },
    19        "address": {
    20            "description": "where does this person live?",
    21            "type": "string",
    22			"minLength": 4,
    23			"maxLength": 20
    24        },
    25        "children": {
    26          "description": "A very large comment that will be wrapped after a certain line length. Let's keep on going and see what happens.",
    27          "type": "array",
    28          "items": { "type": "string" },
    29          "default": []
    30        },
    31        "home phone": {
    32            "type": "string",
    33            "deprecated": true
    34        }
    35      }
    36    }
    37  }
    38}
    39
    40-- out.cue --
    41import "strings"
    42
    43// Main schema
    44//
    45// Specify who you are and all.
    46@jsonschema(schema="http://json-schema.org/draft-07/schema#")
    47
    48// A person is a human being.
    49person?: {
    50	name: string
    51
    52	// where does this person live?
    53	address?: strings.MinRunes(4) & strings.MaxRunes(20)
    54
    55	// A very large comment that will be wrapped after a certain line
    56	// length. Let's keep on going and see what happens.
    57	children?: [...string]
    58	"home phone"?: string @deprecated()
    59	...
    60}
    61...

View as plain text