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