massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-json / node_modules / vscode-json-languageservice / lib / esm / services / configuration.js
1 /*---------------------------------------------------------------------------------------------
2  *  Copyright (c) Microsoft Corporation. All rights reserved.
3  *  Licensed under the MIT License. See License.txt in the project root for license information.
4  *--------------------------------------------------------------------------------------------*/
5 import * as nls from 'vscode-nls';
6 var localize = nls.loadMessageBundle();
7 export var schemaContributions = {
8     schemaAssociations: [],
9     schemas: {
10         // refer to the latest schema
11         'http://json-schema.org/schema#': {
12             $ref: 'http://json-schema.org/draft-07/schema#'
13         },
14         // bundle the schema-schema to include (localized) descriptions
15         'http://json-schema.org/draft-04/schema#': {
16             'title': localize('schema.json', 'Describes a JSON file using a schema. See json-schema.org for more info.'),
17             '$schema': 'http://json-schema.org/draft-04/schema#',
18             'definitions': {
19                 'schemaArray': {
20                     'type': 'array',
21                     'minItems': 1,
22                     'items': {
23                         '$ref': '#'
24                     }
25                 },
26                 'positiveInteger': {
27                     'type': 'integer',
28                     'minimum': 0
29                 },
30                 'positiveIntegerDefault0': {
31                     'allOf': [
32                         {
33                             '$ref': '#/definitions/positiveInteger'
34                         },
35                         {
36                             'default': 0
37                         }
38                     ]
39                 },
40                 'simpleTypes': {
41                     'type': 'string',
42                     'enum': [
43                         'array',
44                         'boolean',
45                         'integer',
46                         'null',
47                         'number',
48                         'object',
49                         'string'
50                     ]
51                 },
52                 'stringArray': {
53                     'type': 'array',
54                     'items': {
55                         'type': 'string'
56                     },
57                     'minItems': 1,
58                     'uniqueItems': true
59                 }
60             },
61             'type': 'object',
62             'properties': {
63                 'id': {
64                     'type': 'string',
65                     'format': 'uri'
66                 },
67                 '$schema': {
68                     'type': 'string',
69                     'format': 'uri'
70                 },
71                 'title': {
72                     'type': 'string'
73                 },
74                 'description': {
75                     'type': 'string'
76                 },
77                 'default': {},
78                 'multipleOf': {
79                     'type': 'number',
80                     'minimum': 0,
81                     'exclusiveMinimum': true
82                 },
83                 'maximum': {
84                     'type': 'number'
85                 },
86                 'exclusiveMaximum': {
87                     'type': 'boolean',
88                     'default': false
89                 },
90                 'minimum': {
91                     'type': 'number'
92                 },
93                 'exclusiveMinimum': {
94                     'type': 'boolean',
95                     'default': false
96                 },
97                 'maxLength': {
98                     'allOf': [
99                         {
100                             '$ref': '#/definitions/positiveInteger'
101                         }
102                     ]
103                 },
104                 'minLength': {
105                     'allOf': [
106                         {
107                             '$ref': '#/definitions/positiveIntegerDefault0'
108                         }
109                     ]
110                 },
111                 'pattern': {
112                     'type': 'string',
113                     'format': 'regex'
114                 },
115                 'additionalItems': {
116                     'anyOf': [
117                         {
118                             'type': 'boolean'
119                         },
120                         {
121                             '$ref': '#'
122                         }
123                     ],
124                     'default': {}
125                 },
126                 'items': {
127                     'anyOf': [
128                         {
129                             '$ref': '#'
130                         },
131                         {
132                             '$ref': '#/definitions/schemaArray'
133                         }
134                     ],
135                     'default': {}
136                 },
137                 'maxItems': {
138                     'allOf': [
139                         {
140                             '$ref': '#/definitions/positiveInteger'
141                         }
142                     ]
143                 },
144                 'minItems': {
145                     'allOf': [
146                         {
147                             '$ref': '#/definitions/positiveIntegerDefault0'
148                         }
149                     ]
150                 },
151                 'uniqueItems': {
152                     'type': 'boolean',
153                     'default': false
154                 },
155                 'maxProperties': {
156                     'allOf': [
157                         {
158                             '$ref': '#/definitions/positiveInteger'
159                         }
160                     ]
161                 },
162                 'minProperties': {
163                     'allOf': [
164                         {
165                             '$ref': '#/definitions/positiveIntegerDefault0'
166                         }
167                     ]
168                 },
169                 'required': {
170                     'allOf': [
171                         {
172                             '$ref': '#/definitions/stringArray'
173                         }
174                     ]
175                 },
176                 'additionalProperties': {
177                     'anyOf': [
178                         {
179                             'type': 'boolean'
180                         },
181                         {
182                             '$ref': '#'
183                         }
184                     ],
185                     'default': {}
186                 },
187                 'definitions': {
188                     'type': 'object',
189                     'additionalProperties': {
190                         '$ref': '#'
191                     },
192                     'default': {}
193                 },
194                 'properties': {
195                     'type': 'object',
196                     'additionalProperties': {
197                         '$ref': '#'
198                     },
199                     'default': {}
200                 },
201                 'patternProperties': {
202                     'type': 'object',
203                     'additionalProperties': {
204                         '$ref': '#'
205                     },
206                     'default': {}
207                 },
208                 'dependencies': {
209                     'type': 'object',
210                     'additionalProperties': {
211                         'anyOf': [
212                             {
213                                 '$ref': '#'
214                             },
215                             {
216                                 '$ref': '#/definitions/stringArray'
217                             }
218                         ]
219                     }
220                 },
221                 'enum': {
222                     'type': 'array',
223                     'minItems': 1,
224                     'uniqueItems': true
225                 },
226                 'type': {
227                     'anyOf': [
228                         {
229                             '$ref': '#/definitions/simpleTypes'
230                         },
231                         {
232                             'type': 'array',
233                             'items': {
234                                 '$ref': '#/definitions/simpleTypes'
235                             },
236                             'minItems': 1,
237                             'uniqueItems': true
238                         }
239                     ]
240                 },
241                 'format': {
242                     'anyOf': [
243                         {
244                             'type': 'string',
245                             'enum': [
246                                 'date-time',
247                                 'uri',
248                                 'email',
249                                 'hostname',
250                                 'ipv4',
251                                 'ipv6',
252                                 'regex'
253                             ]
254                         },
255                         {
256                             'type': 'string'
257                         }
258                     ]
259                 },
260                 'allOf': {
261                     'allOf': [
262                         {
263                             '$ref': '#/definitions/schemaArray'
264                         }
265                     ]
266                 },
267                 'anyOf': {
268                     'allOf': [
269                         {
270                             '$ref': '#/definitions/schemaArray'
271                         }
272                     ]
273                 },
274                 'oneOf': {
275                     'allOf': [
276                         {
277                             '$ref': '#/definitions/schemaArray'
278                         }
279                     ]
280                 },
281                 'not': {
282                     'allOf': [
283                         {
284                             '$ref': '#'
285                         }
286                     ]
287                 }
288             },
289             'dependencies': {
290                 'exclusiveMaximum': [
291                     'maximum'
292                 ],
293                 'exclusiveMinimum': [
294                     'minimum'
295                 ]
296             },
297             'default': {}
298         },
299         'http://json-schema.org/draft-07/schema#': {
300             'title': localize('schema.json', 'Describes a JSON file using a schema. See json-schema.org for more info.'),
301             'definitions': {
302                 'schemaArray': {
303                     'type': 'array',
304                     'minItems': 1,
305                     'items': { '$ref': '#' }
306                 },
307                 'nonNegativeInteger': {
308                     'type': 'integer',
309                     'minimum': 0
310                 },
311                 'nonNegativeIntegerDefault0': {
312                     'allOf': [
313                         { '$ref': '#/definitions/nonNegativeInteger' },
314                         { 'default': 0 }
315                     ]
316                 },
317                 'simpleTypes': {
318                     'enum': [
319                         'array',
320                         'boolean',
321                         'integer',
322                         'null',
323                         'number',
324                         'object',
325                         'string'
326                     ]
327                 },
328                 'stringArray': {
329                     'type': 'array',
330                     'items': { 'type': 'string' },
331                     'uniqueItems': true,
332                     'default': []
333                 }
334             },
335             'type': ['object', 'boolean'],
336             'properties': {
337                 '$id': {
338                     'type': 'string',
339                     'format': 'uri-reference'
340                 },
341                 '$schema': {
342                     'type': 'string',
343                     'format': 'uri'
344                 },
345                 '$ref': {
346                     'type': 'string',
347                     'format': 'uri-reference'
348                 },
349                 '$comment': {
350                     'type': 'string'
351                 },
352                 'title': {
353                     'type': 'string'
354                 },
355                 'description': {
356                     'type': 'string'
357                 },
358                 'default': true,
359                 'readOnly': {
360                     'type': 'boolean',
361                     'default': false
362                 },
363                 'examples': {
364                     'type': 'array',
365                     'items': true
366                 },
367                 'multipleOf': {
368                     'type': 'number',
369                     'exclusiveMinimum': 0
370                 },
371                 'maximum': {
372                     'type': 'number'
373                 },
374                 'exclusiveMaximum': {
375                     'type': 'number'
376                 },
377                 'minimum': {
378                     'type': 'number'
379                 },
380                 'exclusiveMinimum': {
381                     'type': 'number'
382                 },
383                 'maxLength': { '$ref': '#/definitions/nonNegativeInteger' },
384                 'minLength': { '$ref': '#/definitions/nonNegativeIntegerDefault0' },
385                 'pattern': {
386                     'type': 'string',
387                     'format': 'regex'
388                 },
389                 'additionalItems': { '$ref': '#' },
390                 'items': {
391                     'anyOf': [
392                         { '$ref': '#' },
393                         { '$ref': '#/definitions/schemaArray' }
394                     ],
395                     'default': true
396                 },
397                 'maxItems': { '$ref': '#/definitions/nonNegativeInteger' },
398                 'minItems': { '$ref': '#/definitions/nonNegativeIntegerDefault0' },
399                 'uniqueItems': {
400                     'type': 'boolean',
401                     'default': false
402                 },
403                 'contains': { '$ref': '#' },
404                 'maxProperties': { '$ref': '#/definitions/nonNegativeInteger' },
405                 'minProperties': { '$ref': '#/definitions/nonNegativeIntegerDefault0' },
406                 'required': { '$ref': '#/definitions/stringArray' },
407                 'additionalProperties': { '$ref': '#' },
408                 'definitions': {
409                     'type': 'object',
410                     'additionalProperties': { '$ref': '#' },
411                     'default': {}
412                 },
413                 'properties': {
414                     'type': 'object',
415                     'additionalProperties': { '$ref': '#' },
416                     'default': {}
417                 },
418                 'patternProperties': {
419                     'type': 'object',
420                     'additionalProperties': { '$ref': '#' },
421                     'propertyNames': { 'format': 'regex' },
422                     'default': {}
423                 },
424                 'dependencies': {
425                     'type': 'object',
426                     'additionalProperties': {
427                         'anyOf': [
428                             { '$ref': '#' },
429                             { '$ref': '#/definitions/stringArray' }
430                         ]
431                     }
432                 },
433                 'propertyNames': { '$ref': '#' },
434                 'const': true,
435                 'enum': {
436                     'type': 'array',
437                     'items': true,
438                     'minItems': 1,
439                     'uniqueItems': true
440                 },
441                 'type': {
442                     'anyOf': [
443                         { '$ref': '#/definitions/simpleTypes' },
444                         {
445                             'type': 'array',
446                             'items': { '$ref': '#/definitions/simpleTypes' },
447                             'minItems': 1,
448                             'uniqueItems': true
449                         }
450                     ]
451                 },
452                 'format': { 'type': 'string' },
453                 'contentMediaType': { 'type': 'string' },
454                 'contentEncoding': { 'type': 'string' },
455                 'if': { '$ref': '#' },
456                 'then': { '$ref': '#' },
457                 'else': { '$ref': '#' },
458                 'allOf': { '$ref': '#/definitions/schemaArray' },
459                 'anyOf': { '$ref': '#/definitions/schemaArray' },
460                 'oneOf': { '$ref': '#/definitions/schemaArray' },
461                 'not': { '$ref': '#' }
462             },
463             'default': true
464         }
465     }
466 };
467 var descriptions = {
468     id: localize('schema.json.id', "A unique identifier for the schema."),
469     $schema: localize('schema.json.$schema', "The schema to verify this document against."),
470     title: localize('schema.json.title', "A descriptive title of the element."),
471     description: localize('schema.json.description', "A long description of the element. Used in hover menus and suggestions."),
472     default: localize('schema.json.default', "A default value. Used by suggestions."),
473     multipleOf: localize('schema.json.multipleOf', "A number that should cleanly divide the current value (i.e. have no remainder)."),
474     maximum: localize('schema.json.maximum', "The maximum numerical value, inclusive by default."),
475     exclusiveMaximum: localize('schema.json.exclusiveMaximum', "Makes the maximum property exclusive."),
476     minimum: localize('schema.json.minimum', "The minimum numerical value, inclusive by default."),
477     exclusiveMinimum: localize('schema.json.exclusiveMininum', "Makes the minimum property exclusive."),
478     maxLength: localize('schema.json.maxLength', "The maximum length of a string."),
479     minLength: localize('schema.json.minLength', "The minimum length of a string."),
480     pattern: localize('schema.json.pattern', "A regular expression to match the string against. It is not implicitly anchored."),
481     additionalItems: localize('schema.json.additionalItems', "For arrays, only when items is set as an array. If it is a schema, then this schema validates items after the ones specified by the items array. If it is false, then additional items will cause validation to fail."),
482     items: localize('schema.json.items', "For arrays. Can either be a schema to validate every element against or an array of schemas to validate each item against in order (the first schema will validate the first element, the second schema will validate the second element, and so on."),
483     maxItems: localize('schema.json.maxItems', "The maximum number of items that can be inside an array. Inclusive."),
484     minItems: localize('schema.json.minItems', "The minimum number of items that can be inside an array. Inclusive."),
485     uniqueItems: localize('schema.json.uniqueItems', "If all of the items in the array must be unique. Defaults to false."),
486     maxProperties: localize('schema.json.maxProperties', "The maximum number of properties an object can have. Inclusive."),
487     minProperties: localize('schema.json.minProperties', "The minimum number of properties an object can have. Inclusive."),
488     required: localize('schema.json.required', "An array of strings that lists the names of all properties required on this object."),
489     additionalProperties: localize('schema.json.additionalProperties', "Either a schema or a boolean. If a schema, then used to validate all properties not matched by 'properties' or 'patternProperties'. If false, then any properties not matched by either will cause this schema to fail."),
490     definitions: localize('schema.json.definitions', "Not used for validation. Place subschemas here that you wish to reference inline with $ref."),
491     properties: localize('schema.json.properties', "A map of property names to schemas for each property."),
492     patternProperties: localize('schema.json.patternProperties', "A map of regular expressions on property names to schemas for matching properties."),
493     dependencies: localize('schema.json.dependencies', "A map of property names to either an array of property names or a schema. An array of property names means the property named in the key depends on the properties in the array being present in the object in order to be valid. If the value is a schema, then the schema is only applied to the object if the property in the key exists on the object."),
494     enum: localize('schema.json.enum', "The set of literal values that are valid."),
495     type: localize('schema.json.type', "Either a string of one of the basic schema types (number, integer, null, array, object, boolean, string) or an array of strings specifying a subset of those types."),
496     format: localize('schema.json.format', "Describes the format expected for the value."),
497     allOf: localize('schema.json.allOf', "An array of schemas, all of which must match."),
498     anyOf: localize('schema.json.anyOf', "An array of schemas, where at least one must match."),
499     oneOf: localize('schema.json.oneOf', "An array of schemas, exactly one of which must match."),
500     not: localize('schema.json.not', "A schema which must not match."),
501     $id: localize('schema.json.$id', "A unique identifier for the schema."),
502     $ref: localize('schema.json.$ref', "Reference a definition hosted on any location."),
503     $comment: localize('schema.json.$comment', "Comments from schema authors to readers or maintainers of the schema."),
504     readOnly: localize('schema.json.readOnly', "Indicates that the value of the instance is managed exclusively by the owning authority."),
505     examples: localize('schema.json.examples', "Sample JSON values associated with a particular schema, for the purpose of illustrating usage."),
506     contains: localize('schema.json.contains', "An array instance is valid against \"contains\" if at least one of its elements is valid against the given schema."),
507     propertyNames: localize('schema.json.propertyNames', "If the instance is an object, this keyword validates if every property name in the instance validates against the provided schema."),
508     const: localize('schema.json.const', "An instance validates successfully against this keyword if its value is equal to the value of the keyword."),
509     contentMediaType: localize('schema.json.contentMediaType', "Describes the media type of a string property."),
510     contentEncoding: localize('schema.json.contentEncoding', "Describes the content encoding of a string property."),
511     if: localize('schema.json.if', "The validation outcome of the \"if\" subschema controls which of the \"then\" or \"else\" keywords are evaluated."),
512     then: localize('schema.json.then', "The \"if\" subschema is used for validation when the \"if\" subschema succeeds."),
513     else: localize('schema.json.else', "The \"else\" subschema is used for validation when the \"if\" subschema fails.")
514 };
515 for (var schemaName in schemaContributions.schemas) {
516     var schema = schemaContributions.schemas[schemaName];
517     for (var property in schema.properties) {
518         var propertyObject = schema.properties[property];
519         if (typeof propertyObject === 'boolean') {
520             propertyObject = schema.properties[property] = {};
521         }
522         var description = descriptions[property];
523         if (description) {
524             propertyObject['description'] = description;
525         }
526         else {
527             console.log(property + ": localize('schema.json." + property + "', \"\")");
528         }
529     }
530 }