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: [],
10 // refer to the latest schema
11 'http://json-schema.org/schema#': {
12 $ref: 'http://json-schema.org/draft-07/schema#'
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#',
30 'positiveIntegerDefault0': {
33 '$ref': '#/definitions/positiveInteger'
81 'exclusiveMinimum': true
100 '$ref': '#/definitions/positiveInteger'
107 '$ref': '#/definitions/positiveIntegerDefault0'
132 '$ref': '#/definitions/schemaArray'
140 '$ref': '#/definitions/positiveInteger'
147 '$ref': '#/definitions/positiveIntegerDefault0'
158 '$ref': '#/definitions/positiveInteger'
165 '$ref': '#/definitions/positiveIntegerDefault0'
172 '$ref': '#/definitions/stringArray'
176 'additionalProperties': {
189 'additionalProperties': {
196 'additionalProperties': {
201 'patternProperties': {
203 'additionalProperties': {
210 'additionalProperties': {
216 '$ref': '#/definitions/stringArray'
229 '$ref': '#/definitions/simpleTypes'
234 '$ref': '#/definitions/simpleTypes'
263 '$ref': '#/definitions/schemaArray'
270 '$ref': '#/definitions/schemaArray'
277 '$ref': '#/definitions/schemaArray'
290 'exclusiveMaximum': [
293 'exclusiveMinimum': [
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.'),
305 'items': { '$ref': '#' }
307 'nonNegativeInteger': {
311 'nonNegativeIntegerDefault0': {
313 { '$ref': '#/definitions/nonNegativeInteger' },
330 'items': { 'type': 'string' },
335 'type': ['object', 'boolean'],
339 'format': 'uri-reference'
347 'format': 'uri-reference'
369 'exclusiveMinimum': 0
374 'exclusiveMaximum': {
380 'exclusiveMinimum': {
383 'maxLength': { '$ref': '#/definitions/nonNegativeInteger' },
384 'minLength': { '$ref': '#/definitions/nonNegativeIntegerDefault0' },
389 'additionalItems': { '$ref': '#' },
393 { '$ref': '#/definitions/schemaArray' }
397 'maxItems': { '$ref': '#/definitions/nonNegativeInteger' },
398 'minItems': { '$ref': '#/definitions/nonNegativeIntegerDefault0' },
403 'contains': { '$ref': '#' },
404 'maxProperties': { '$ref': '#/definitions/nonNegativeInteger' },
405 'minProperties': { '$ref': '#/definitions/nonNegativeIntegerDefault0' },
406 'required': { '$ref': '#/definitions/stringArray' },
407 'additionalProperties': { '$ref': '#' },
410 'additionalProperties': { '$ref': '#' },
415 'additionalProperties': { '$ref': '#' },
418 'patternProperties': {
420 'additionalProperties': { '$ref': '#' },
421 'propertyNames': { 'format': 'regex' },
426 'additionalProperties': {
429 { '$ref': '#/definitions/stringArray' }
433 'propertyNames': { '$ref': '#' },
443 { '$ref': '#/definitions/simpleTypes' },
446 'items': { '$ref': '#/definitions/simpleTypes' },
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': '#' }
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.")
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] = {};
522 var description = descriptions[property];
524 propertyObject['description'] = description;
527 console.log(property + ": localize('schema.json." + property + "', \"\")");