summaryrefslogtreecommitdiff
path: root/vendor/schemars/examples/doc_comments.schema.json
blob: a3aa7670cc259a4701f6eabf9c1da503bea7ed49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "My Amazing Struct",
  "description": "This struct shows off generating a schema with\n a custom title and description.",
  "type": "object",
  "properties": {
    "my_bool": {
      "description": "This bool has a description, but no title.",
      "type": "boolean"
    },
    "my_int": {
      "title": "My Amazing Integer",
      "type": "integer",
      "format": "int32"
    },
    "my_nullable_enum": {
      "title": "A Nullable Enum",
      "description": "This enum might be set, or it might not.",
      "anyOf": [
        {
          "$ref": "#/$defs/MyEnum"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "my_int",
    "my_bool"
  ],
  "$defs": {
    "MyEnum": {
      "title": "My Amazing Enum",
      "oneOf": [
        {
          "description": "A wrapper around a `String`",
          "type": "object",
          "properties": {
            "StringNewType": {
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": [
            "StringNewType"
          ]
        },
        {
          "description": "A struct-like enum variant which contains\n some floats",
          "type": "object",
          "properties": {
            "StructVariant": {
              "type": "object",
              "properties": {
                "floats": {
                  "description": "The floats themselves",
                  "type": "array",
                  "items": {
                    "type": "number",
                    "format": "float"
                  }
                }
              },
              "required": [
                "floats"
              ]
            }
          },
          "additionalProperties": false,
          "required": [
            "StructVariant"
          ]
        }
      ]
    }
  }
}