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 *--------------------------------------------------------------------------------------------*/
6 if (typeof module === "object" && typeof module.exports === "object") {
7 var v = factory(require, exports);
8 if (v !== undefined) module.exports = v;
10 else if (typeof define === "function" && define.amd) {
11 define(["require", "exports", "vscode-nls"], factory);
13 })(function (require, exports) {
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: [],
22 // refer to the latest schema
23 'http://json-schema.org/schema#': {
24 $ref: 'http://json-schema.org/draft-07/schema#'
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#',
42 'positiveIntegerDefault0': {
45 '$ref': '#/definitions/positiveInteger'
93 'exclusiveMinimum': true
105 'exclusiveMinimum': {
112 '$ref': '#/definitions/positiveInteger'
119 '$ref': '#/definitions/positiveIntegerDefault0'
144 '$ref': '#/definitions/schemaArray'
152 '$ref': '#/definitions/positiveInteger'
159 '$ref': '#/definitions/positiveIntegerDefault0'
170 '$ref': '#/definitions/positiveInteger'
177 '$ref': '#/definitions/positiveIntegerDefault0'
184 '$ref': '#/definitions/stringArray'
188 'additionalProperties': {
201 'additionalProperties': {
208 'additionalProperties': {
213 'patternProperties': {
215 'additionalProperties': {
222 'additionalProperties': {
228 '$ref': '#/definitions/stringArray'
241 '$ref': '#/definitions/simpleTypes'
246 '$ref': '#/definitions/simpleTypes'
275 '$ref': '#/definitions/schemaArray'
282 '$ref': '#/definitions/schemaArray'
289 '$ref': '#/definitions/schemaArray'
302 'exclusiveMaximum': [
305 'exclusiveMinimum': [
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.'),
317 'items': { '$ref': '#' }
319 'nonNegativeInteger': {
323 'nonNegativeIntegerDefault0': {
325 { '$ref': '#/definitions/nonNegativeInteger' },
342 'items': { 'type': 'string' },
347 'type': ['object', 'boolean'],
351 'format': 'uri-reference'
359 'format': 'uri-reference'
381 'exclusiveMinimum': 0
386 'exclusiveMaximum': {
392 'exclusiveMinimum': {
395 'maxLength': { '$ref': '#/definitions/nonNegativeInteger' },
396 'minLength': { '$ref': '#/definitions/nonNegativeIntegerDefault0' },
401 'additionalItems': { '$ref': '#' },
405 { '$ref': '#/definitions/schemaArray' }
409 'maxItems': { '$ref': '#/definitions/nonNegativeInteger' },
410 'minItems': { '$ref': '#/definitions/nonNegativeIntegerDefault0' },
415 'contains': { '$ref': '#' },
416 'maxProperties': { '$ref': '#/definitions/nonNegativeInteger' },
417 'minProperties': { '$ref': '#/definitions/nonNegativeIntegerDefault0' },
418 'required': { '$ref': '#/definitions/stringArray' },
419 'additionalProperties': { '$ref': '#' },
422 'additionalProperties': { '$ref': '#' },
427 'additionalProperties': { '$ref': '#' },
430 'patternProperties': {
432 'additionalProperties': { '$ref': '#' },
433 'propertyNames': { 'format': 'regex' },
438 'additionalProperties': {
441 { '$ref': '#/definitions/stringArray' }
445 'propertyNames': { '$ref': '#' },
455 { '$ref': '#/definitions/simpleTypes' },
458 'items': { '$ref': '#/definitions/simpleTypes' },
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': '#' }
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.")
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] = {};
534 var description = descriptions[property];
536 propertyObject['description'] = description;
539 console.log(property + ": localize('schema.json." + property + "', \"\")");