rbs 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,87 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "definitions": {
4
+ "param": {
5
+ "title": "Function parameter with type and optional name: `Integer size`, `::String name`, `untyped`, ...",
6
+ "type": "object",
7
+ "properties": {
8
+ "type": {
9
+ "$ref": "types.json"
10
+ },
11
+ "name": {
12
+ "oneOf": [
13
+ {
14
+ "type": "string"
15
+ },
16
+ {
17
+ "type": "null"
18
+ }
19
+ ]
20
+ }
21
+ },
22
+ "required": ["type", "name"]
23
+ }
24
+ },
25
+ "properties": {
26
+ "required_positionals": {
27
+ "title": "Required positional parameters",
28
+ "type": "array",
29
+ "items": {
30
+ "$ref": "#/definitions/param"
31
+ }
32
+ },
33
+ "optional_positionals": {
34
+ "title": "Optional positional parameters",
35
+ "type": "array",
36
+ "items": {
37
+ "$ref": "#/definitions/param"
38
+ }
39
+ },
40
+ "rest_positionals": {
41
+ "title": "Rest parameter",
42
+ "oneOf": [
43
+ {
44
+ "$ref": "#/definitions/param"
45
+ },
46
+ {
47
+ "type": "null"
48
+ }
49
+ ]
50
+ },
51
+ "trailing_positionals": {
52
+ "title": "Trailing potisional parameters",
53
+ "type": "array",
54
+ "items": {
55
+ "$ref": "#/definitions/param"
56
+ }
57
+ },
58
+ "required_keywords": {
59
+ "title": "Required keyword parameters",
60
+ "additionalProperties": {
61
+ "$ref": "#/definitions/param"
62
+ }
63
+ },
64
+ "optional_keywords": {
65
+ "title": "Optional keyword parameters",
66
+ "additionalProperties": {
67
+ "$ref": "#/definitions/param"
68
+ }
69
+ },
70
+ "rest_keywords": {
71
+ "title": "Rest keyword parameters",
72
+ "oneOf": [
73
+ {
74
+ "$ref": "#/definitions/param"
75
+ },
76
+ {
77
+ "type": "null"
78
+ }
79
+ ]
80
+ },
81
+ "return_type": {
82
+ "title": "Return type of a function",
83
+ "$ref": "types.json"
84
+ }
85
+ },
86
+ "required": ["required_positionals", "optional_positionals", "rest_positionals", "trailing_positionals", "required_keywords", "optional_keywords", "rest_keywords", "return_type"]
87
+ }
@@ -0,0 +1,56 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "definitions": {
4
+ "point": {
5
+ "type": "object",
6
+ "properties": {
7
+ "line": {
8
+ "type": "integer"
9
+ },
10
+ "column": {
11
+ "type": "integer"
12
+ }
13
+ },
14
+ "required": ["line", "column"]
15
+ },
16
+ "buffer": {
17
+ "type": "object",
18
+ "properties": {
19
+ "name": {
20
+ "oneOf": [
21
+ {
22
+ "type": "string"
23
+ },
24
+ {
25
+ "type": "null"
26
+ }
27
+ ]
28
+ }
29
+ },
30
+ "required": ["name"]
31
+ },
32
+ "location": {
33
+ "type": "object",
34
+ "properties": {
35
+ "start": {
36
+ "$ref": "#/definitions/point"
37
+ },
38
+ "end": {
39
+ "$ref": "#/definitions/point"
40
+ },
41
+ "buffer": {
42
+ "$ref": "#/definitions/buffer"
43
+ }
44
+ },
45
+ "required": ["start", "end", "buffer"]
46
+ }
47
+ },
48
+ "oneOf": [
49
+ {
50
+ "$ref": "#/definitions/location"
51
+ },
52
+ {
53
+ "type": "null"
54
+ }
55
+ ]
56
+ }
@@ -0,0 +1,245 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "definitions": {
4
+ "methodDefinition": {
5
+ "type": "object",
6
+ "properties": {
7
+ "member": {
8
+ "type": "string",
9
+ "enum": ["method_definition"]
10
+ },
11
+ "kind": {
12
+ "enum": ["instance", "singleton", "singleton_instance"]
13
+ },
14
+ "types": {
15
+ "type": "array",
16
+ "items": {
17
+ "$ref": "methodType.json"
18
+ }
19
+ },
20
+ "comment": {
21
+ "$ref": "comment.json"
22
+ },
23
+ "annotations": {
24
+ "type": "array",
25
+ "items": {
26
+ "$ref": "annotation.json"
27
+ }
28
+ },
29
+ "attributes": {
30
+ "type": "array",
31
+ "items": {
32
+ "enum": ["incompatible"]
33
+ }
34
+ },
35
+ "location": {
36
+ "$ref": "location.json"
37
+ }
38
+ },
39
+ "required": ["member", "kind", "types", "comment", "annotations", "location"]
40
+ },
41
+ "variable": {
42
+ "title": "Declaration for instance variables and class variables",
43
+ "description": "`@x: Integer`, `self.@x: String`, `@@name: Symbol`, ...",
44
+ "type": "object",
45
+ "properties": {
46
+ "member": {
47
+ "enum": ["instance_variable", "class_instance_variable", "class_variable"]
48
+ },
49
+ "name": {
50
+ "type": "string"
51
+ },
52
+ "type": {
53
+ "$ref": "types.json"
54
+ },
55
+ "location": {
56
+ "$ref": "location.json"
57
+ },
58
+ "comment": {
59
+ "$ref": "comment.json"
60
+ }
61
+ },
62
+ "required": ["member", "name", "type", "location", "comment"]
63
+ },
64
+ "include": {
65
+ "title": "Include mixin",
66
+ "properties": {
67
+ "member": {
68
+ "enum": ["include"]
69
+ },
70
+ "name": {
71
+ "type": "string"
72
+ },
73
+ "args": {
74
+ "type": "array",
75
+ "items": {
76
+ "$ref": "types.json"
77
+ }
78
+ },
79
+ "annotations": {
80
+ "type": "array",
81
+ "items": {
82
+ "$ref": "annotation.json"
83
+ }
84
+ },
85
+ "comment": {
86
+ "$ref": "comment.json"
87
+ },
88
+ "location": {
89
+ "$ref": "location.json"
90
+ }
91
+ },
92
+ "required": ["member", "name", "args", "annotations", "comment", "location"]
93
+ },
94
+ "extend": {
95
+ "title": "Extend mixin",
96
+ "properties": {
97
+ "member": {
98
+ "enum": ["extend"]
99
+ },
100
+ "name": {
101
+ "type": "string"
102
+ },
103
+ "args": {
104
+ "type": "array",
105
+ "items": {
106
+ "$ref": "types.json"
107
+ }
108
+ },
109
+ "annotations": {
110
+ "type": "array",
111
+ "items": {
112
+ "$ref": "annotation.json"
113
+ }
114
+ },
115
+ "comment": {
116
+ "$ref": "comment.json"
117
+ },
118
+ "location": {
119
+ "$ref": "location.json"
120
+ }
121
+ },
122
+ "required": ["member", "name", "args", "annotations", "comment", "location"]
123
+ },
124
+ "prepend": {
125
+ "title": "Prepend mixin",
126
+ "properties": {
127
+ "member": {
128
+ "enum": ["prepend"]
129
+ },
130
+ "name": {
131
+ "type": "string"
132
+ },
133
+ "args": {
134
+ "type": "array",
135
+ "items": {
136
+ "$ref": "types.json"
137
+ }
138
+ },
139
+ "annotations": {
140
+ "type": "array",
141
+ "items": {
142
+ "$ref": "annotation.json"
143
+ }
144
+ },
145
+ "comment": {
146
+ "$ref": "comment.json"
147
+ },
148
+ "location": {
149
+ "$ref": "location.json"
150
+ }
151
+ },
152
+ "required": ["member", "name", "args", "annotations", "comment", "location"]
153
+ },
154
+ "attribute": {
155
+ "title": "Attribute definitions",
156
+ "description": "`attr_reader`, `attr_accessor`, `attr_writer`",
157
+ "properties": {
158
+ "member": {
159
+ "type": "string",
160
+ "enum": ["attr_reader", "attr_accessor", "attr_writer"]
161
+ },
162
+ "name": {
163
+ "type": "string"
164
+ },
165
+ "type": {
166
+ "$ref": "types.json"
167
+ },
168
+ "ivar_name": {
169
+ "oneOf": [
170
+ {
171
+ "type": "string"
172
+ },
173
+ {
174
+ "type": "null"
175
+ },
176
+ {
177
+ "enum": [false]
178
+ }
179
+ ]
180
+ },
181
+ "annotations": {
182
+ "type": "array",
183
+ "items": {
184
+ "$ref": "annotation.json"
185
+ }
186
+ },
187
+ "comment": {
188
+ "$ref": "comment.json"
189
+ },
190
+ "location": {
191
+ "$ref": "location.json"
192
+ }
193
+ },
194
+ "required": ["member", "name", "ivar_name", "type", "annotations", "comment", "location"]
195
+ },
196
+ "visibility": {
197
+ "title": "Visibility specifier",
198
+ "description": "`public` and `private`.",
199
+ "type": "object",
200
+ "properties": {
201
+ "member": {
202
+ "type": "string",
203
+ "enum": ["public", "private"]
204
+ },
205
+ "location": {
206
+ "$ref": "location.json"
207
+ }
208
+ },
209
+ "required": ["member", "location"]
210
+ },
211
+ "alias": {
212
+ "title": "Alias declaration",
213
+ "description": "`alias to_s inspect`, `alias self.new self.allocate`, ...",
214
+ "properties": {
215
+ "member": {
216
+ "type": "string",
217
+ "enum": ["alias"]
218
+ },
219
+ "new_name": {
220
+ "type": "string"
221
+ },
222
+ "old_name": {
223
+ "type": "string"
224
+ },
225
+ "kind": {
226
+ "type": "string",
227
+ "enum": ["instance", "singleton"]
228
+ },
229
+ "annotations": {
230
+ "type": "array",
231
+ "items": {
232
+ "$ref": "annotation.json"
233
+ }
234
+ },
235
+ "comment": {
236
+ "$ref": "comment.json"
237
+ },
238
+ "location": {
239
+ "$ref": "location.json"
240
+ }
241
+ },
242
+ "required": ["member", "new_name", "old_name", "kind", "annotations", "comment", "location"]
243
+ }
244
+ }
245
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "definitions": {
4
+ "block": {
5
+ "type": "object",
6
+ "properties": {
7
+ "type": {
8
+ "$ref": "function.json"
9
+ },
10
+ "required": {
11
+ "type": "boolean"
12
+ }
13
+ },
14
+ "required": ["type", "required"]
15
+ }
16
+ },
17
+ "title": "Method type: `() -> void`, `[X] (::Integer) { (::String) -> X } -> Array[X]`, ...",
18
+ "type": "object",
19
+ "properties": {
20
+ "type_params": {
21
+ "type": "array",
22
+ "items": {
23
+ "type": "string"
24
+ }
25
+ },
26
+ "type": {
27
+ "$ref": "function.json"
28
+ },
29
+ "block": {
30
+ "oneOf": [
31
+ {
32
+ "$ref": "#/definitions/block"
33
+ },
34
+ {
35
+ "type": "null"
36
+ }
37
+ ]
38
+ },
39
+ "location": {
40
+ "$ref": "location.json"
41
+ }
42
+ },
43
+ "required": ["type_params", "type", "block", "location"]
44
+ }
@@ -0,0 +1,299 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "definitions": {
4
+ "base": {
5
+ "title": "Base types",
6
+ "type": "object",
7
+ "properties": {
8
+ "class": {
9
+ "type": "string",
10
+ "enum": [
11
+ "bool",
12
+ "void",
13
+ "untyped",
14
+ "nil",
15
+ "top",
16
+ "bot",
17
+ "self",
18
+ "instance",
19
+ "class"
20
+ ]
21
+ },
22
+ "location": {
23
+ "$ref": "location.json"
24
+ }
25
+ },
26
+ "required": ["class", "location"]
27
+ },
28
+ "variable": {
29
+ "title": "Type variables: `X`, `Y`, `Elem`, `Key`, ...",
30
+ "type": "object",
31
+ "properties": {
32
+ "class": {
33
+ "type": "string",
34
+ "enum": ["variable"]
35
+ },
36
+ "name": {
37
+ "type": "string"
38
+ },
39
+ "location": {
40
+ "$ref": "location.json"
41
+ }
42
+ },
43
+ "required": ["class", "name", "location"]
44
+ },
45
+ "classSingleton": {
46
+ "title": "Class singleton type: `singleton(Object)`, `singleton(::Kernel)`, ...",
47
+ "type": "object",
48
+ "properties": {
49
+ "class": {
50
+ "type": "string",
51
+ "enum": ["class_singleton"]
52
+ },
53
+ "name": {
54
+ "type": "string"
55
+ },
56
+ "location": {
57
+ "$ref": "location.json"
58
+ }
59
+ },
60
+ "required": ["class", "name", "location"]
61
+ },
62
+ "classInstance": {
63
+ "title": "Class instance type: `String`, `::Enumerable`, `Array[::Symbol]`, ...",
64
+ "type": "object",
65
+ "properties": {
66
+ "class": {
67
+ "type": "string",
68
+ "enum": ["class_instance"]
69
+ },
70
+ "name": {
71
+ "type": "string"
72
+ },
73
+ "args": {
74
+ "type": "array",
75
+ "items": {
76
+ "$ref": "#"
77
+ }
78
+ },
79
+ "location": {
80
+ "$ref": "location.json"
81
+ }
82
+ },
83
+ "required": ["class", "name", "args", "location"]
84
+ },
85
+ "interface": {
86
+ "title": "Interface type: `_Each[String, void]`, `_ToStr`, ...",
87
+ "type": "object",
88
+ "properties": {
89
+ "class": {
90
+ "type": "string",
91
+ "enum": ["interface"]
92
+ },
93
+ "name": {
94
+ "type": "string"
95
+ },
96
+ "args": {
97
+ "type": "array",
98
+ "items": {
99
+ "$ref": "#"
100
+ }
101
+ },
102
+ "location": {
103
+ "$ref": "location.json"
104
+ }
105
+ },
106
+ "required": ["class", "name", "args", "location"]
107
+ },
108
+ "alias": {
109
+ "title": "Type alias: `u`, `ty`, `json`, ...",
110
+ "type": "object",
111
+ "properties": {
112
+ "class": {
113
+ "type": "string",
114
+ "enum": ["alias"]
115
+ },
116
+ "name": {
117
+ "type": "string"
118
+ },
119
+ "location": {
120
+ "$ref": "location.json"
121
+ }
122
+ },
123
+ "required": ["class", "name", "location"]
124
+ },
125
+ "tuple": {
126
+ "title": "Tuple type: `[Foo, bar]`, ...",
127
+ "type": "object",
128
+ "properties": {
129
+ "class": {
130
+ "type": "string",
131
+ "enum": ["tuple"]
132
+ },
133
+ "types": {
134
+ "type": "array",
135
+ "items": {
136
+ "$ref": "#"
137
+ }
138
+ },
139
+ "location": {
140
+ "$ref": "location.json"
141
+ }
142
+ },
143
+ "required": ["class", "types", "location"]
144
+ },
145
+ "record": {
146
+ "title": "Record type: `{ id: Integer, email: String }`, ...",
147
+ "type": "object",
148
+ "properties": {
149
+ "class": {
150
+ "type": "string",
151
+ "enum": ["record"]
152
+ },
153
+ "fields": {
154
+ "type": "object",
155
+ "additionalProperties": {
156
+ "$ref": "#"
157
+ }
158
+ },
159
+ "location": {
160
+ "$ref": "location.json"
161
+ }
162
+ },
163
+ "required": ["class", "fields", "location"]
164
+ },
165
+ "optional": {
166
+ "title": "Optional types: `Integer?`, ...",
167
+ "type": "object",
168
+ "properties": {
169
+ "class": {
170
+ "type": "string",
171
+ "enum": ["optional"]
172
+ },
173
+ "type": {
174
+ "$ref": "#"
175
+ },
176
+ "location": {
177
+ "$ref": "location.json"
178
+ }
179
+ },
180
+ "required": ["class", "type", "location"]
181
+ },
182
+ "union": {
183
+ "title": "Union types: `Integer | String`, ...",
184
+ "type": "object",
185
+ "properties": {
186
+ "class": {
187
+ "type": "string",
188
+ "enum": ["union"]
189
+ },
190
+ "types": {
191
+ "type": "array",
192
+ "items": {
193
+ "$ref": "#"
194
+ }
195
+ },
196
+ "location": {
197
+ "$ref": "location.json"
198
+ }
199
+ },
200
+ "required": ["class", "types", "location"]
201
+ },
202
+ "intersection": {
203
+ "title": "Intersection types: `Integer & String`, ...",
204
+ "type": "object",
205
+ "properties": {
206
+ "class": {
207
+ "type": "string",
208
+ "enum": ["intersection"]
209
+ },
210
+ "types": {
211
+ "type": "array",
212
+ "items": {
213
+ "$ref": "#"
214
+ }
215
+ },
216
+ "location": {
217
+ "$ref": "location.json"
218
+ }
219
+ },
220
+ "required": ["class", "types", "location"]
221
+ },
222
+ "proc": {
223
+ "title": "Proc types: `^() -> void`, ...",
224
+ "type": "object",
225
+ "properties": {
226
+ "class": {
227
+ "type": "string",
228
+ "enum": ["proc"]
229
+ },
230
+ "type": {
231
+ "$ref": "function.json"
232
+ },
233
+ "location": {
234
+ "$ref": "location.json"
235
+ }
236
+ },
237
+ "required": ["class", "type", "location"]
238
+ },
239
+ "literal": {
240
+ "title": "Literal types: `1`, `:foo`, `\"foo\"`, ...",
241
+ "type": "object",
242
+ "properties": {
243
+ "class": {
244
+ "type": "string",
245
+ "enum": ["literal"]
246
+ },
247
+ "literal": {
248
+ "type": "string"
249
+ },
250
+ "location": {
251
+ "$ref": "location.json"
252
+ }
253
+ },
254
+ "required": ["class", "literal", "location"]
255
+ }
256
+ },
257
+ "title": "Type",
258
+ "oneOf": [
259
+ {
260
+ "$ref": "#/definitions/base"
261
+ },
262
+ {
263
+ "$ref": "#/definitions/variable"
264
+ },
265
+ {
266
+ "$ref": "#/definitions/classInstance"
267
+ },
268
+ {
269
+ "$ref": "#/definitions/classSingleton"
270
+ },
271
+ {
272
+ "$ref": "#/definitions/interface"
273
+ },
274
+ {
275
+ "$ref": "#/definitions/alias"
276
+ },
277
+ {
278
+ "$ref": "#/definitions/tuple"
279
+ },
280
+ {
281
+ "$ref": "#/definitions/record"
282
+ },
283
+ {
284
+ "$ref": "#/definitions/union"
285
+ },
286
+ {
287
+ "$ref": "#/definitions/intersection"
288
+ },
289
+ {
290
+ "$ref": "#/definitions/optional"
291
+ },
292
+ {
293
+ "$ref": "#/definitions/proc"
294
+ },
295
+ {
296
+ "$ref": "#/definitions/literal"
297
+ }
298
+ ]
299
+ }