-
Notifications
You must be signed in to change notification settings - Fork 0
/
json-schema-for-avro-schema-1-7-3.json
146 lines (146 loc) · 5.53 KB
/
json-schema-for-avro-schema-1-7-3.json
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "avro-schema",
"description": "JSON Schema for an Apache Avro schema, version 1.7.3",
"notes": [
"Adapted from https://github.com/fge/sample-json-schemas",
"The Apache Avro project does not appear to define json schemas for its avro schema spec.",
"I'm using this as a test-bed for adding unit analysis information to Avro schema resolution."
],
"oneOf": [
{ "type": "string" },
{
"type": "object",
"required": [ "type" ],
"properties": {
"type": { "$ref": "#/definitions/primitiveTypes" }
}
},
{ "$ref": "#/definitions/record" },
{ "$ref": "#/definitions/enum" },
{ "$ref": "#/definitions/array" },
{ "$ref": "#/definitions/map" },
{ "$ref": "#/definitions/union" },
{ "$ref": "#/definitions/fixed" }
],
"definitions": {
"primitiveTypes": {
"description": "One primitive type",
"enum": [ "null", "boolean", "int", "long", "float", "double", "bytes", "string" ]
},
"record": {
"description": "A record",
"type": "object",
"required": [ "type", "name", "fields" ],
"properties": {
"type": { "enum": [ "record" ] },
"name": { "$ref": "#/definitions/nameOrNamespace" },
"nameOrNamespace": { "$ref": "#/definitions/nameOrNamespace" },
"doc": { "type": "string" },
"aliases": { "$ref": "#/definitions/aliases" },
"fields": {
"type": "array",
"items": { "$ref": "#/definitions/field" }
}
}
},
"enum": {
"description": "an enum as defined by the Avro specification",
"type": "object",
"required": [ "type", "name", "symbols" ],
"properties": {
"type": { "enum": [ "enum" ] },
"name": { "$ref": "#/definitions/nameOrNamespace" },
"nameOrNamespace": { "$ref": "#/definitions/nameOrNamespace" },
"aliases": { "$ref": "#/definitions/aliases" },
"doc": { "type": "string" },
"symbols": {
"type": "array",
"minItems": 1,
"items": {
"type": "string",
"minLength": 1,
"pattern": "^(?![_\\d])\\w+$"
},
"uniqueItems": true
}
}
},
"array": {
"description": "An array as defined by the Avro specification",
"notes": [ "spec doesn't say whether \"items\" is required!" ],
"type": "object",
"required": [ "type" ],
"properties": {
"type": { "enum": [ "array" ] },
"items": { "$ref": "#" }
}
},
"map": {
"description": "A map as defined by the Avro specification",
"notes": [ "spec doesn't say whether \"values\" is required!" ],
"type": "object",
"required": [ "type" ],
"properties": {
"type": { "enum": [ "map" ] },
"values": { "$ref": "#" }
}
},
"union": {
"description": "A union of schemas",
"type": "array",
"uniqueItems": true,
"items": {
"allOf": [
{ "$ref": "#" },
{ "not": { "$ref": "#/definitions/union" } }
]
}
},
"fixed": {
"description": "A fixed type, as defined by the Avro specification",
"type": "object",
"required": [ "type", "name", "size" ],
"properties": {
"type": { "enum": [ "fixed" ] },
"name": { "$ref": "#/definitions/nameOrNamespace" },
"nameOrNamespace": { "$ref": "#/definitions/nameOrNamespace" },
"size": {
"type": "integer",
"minimum": 0,
"exclusiveMinimum": true
},
"aliases": { "$ref": "#/definitions/aliases" }
}
},
"nameOrNamespace": {
"description": "what a nameOrNamespace can be",
"type": "string",
"pattern": "^[A-Za-z_][A-Za-z0-9_]*(\\.[A-Za-z_][A-Za-z0-9_]*)*$"
},
"aliases": {
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {"$ref": "#/definitions/nameOrNamespace" }
},
"field": {
"description": "One field in a record",
"type": "object",
"required": [ "name", "type" ],
"properties": {
"name": { "$ref": "#/definitions/nameOrNamespace" },
"doc": { "type": "string" },
"type": { "$ref": "#" },
"unit": { "$ref": "https://raw.githubusercontent.com/erikerlandson/unit-analysis-json-schema/master/unit-analysis-schema.json#/definitions/unit_expr" },
"default": {
"description": "default value, depending on the type"
},
"order": {
"enum": [ "ascending", "descending", "ignore" ]
},
"aliases": { "$ref": "#/definitions/aliases" }
}
}
}
}