yaml-language-server 1.24.1-ff2c8ea.0 → 1.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +62 -0
- package/Dockerfile +4 -5
- package/README.md +439 -293
- package/eslint.config.mjs +55 -0
- package/lib/esm/index.d.ts +0 -1
- package/lib/esm/index.js +0 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/languageserver/commandExecutor.d.ts +1 -1
- package/lib/esm/languageserver/commandExecutor.js.map +1 -1
- package/lib/esm/languageserver/handlers/languageHandlers.d.ts +8 -9
- package/lib/esm/languageserver/handlers/languageHandlers.js +23 -11
- package/lib/esm/languageserver/handlers/languageHandlers.js.map +1 -1
- package/lib/esm/languageserver/handlers/notificationHandlers.d.ts +4 -4
- package/lib/esm/languageserver/handlers/requestHandlers.d.ts +2 -2
- package/lib/esm/languageserver/handlers/requestHandlers.js +1 -1
- package/lib/esm/languageserver/handlers/requestHandlers.js.map +1 -1
- package/lib/esm/languageserver/handlers/schemaSelectionHandlers.d.ts +4 -4
- package/lib/esm/languageserver/handlers/schemaSelectionHandlers.js +8 -10
- package/lib/esm/languageserver/handlers/schemaSelectionHandlers.js.map +1 -1
- package/lib/esm/languageserver/handlers/settingsHandlers.d.ts +8 -5
- package/lib/esm/languageserver/handlers/settingsHandlers.js +68 -38
- package/lib/esm/languageserver/handlers/settingsHandlers.js.map +1 -1
- package/lib/esm/languageserver/handlers/validationHandlers.d.ts +5 -5
- package/lib/esm/languageserver/handlers/validationHandlers.js +19 -23
- package/lib/esm/languageserver/handlers/validationHandlers.js.map +1 -1
- package/lib/esm/languageserver/handlers/workspaceHandlers.d.ts +2 -2
- package/lib/esm/languageserver/telemetry.d.ts +2 -2
- package/lib/esm/languageservice/jsonLanguageTypes.d.ts +302 -0
- package/lib/esm/languageservice/jsonLanguageTypes.js +60 -0
- package/lib/esm/languageservice/jsonLanguageTypes.js.map +1 -0
- package/lib/esm/languageservice/jsonSchema.d.ts +5 -9
- package/lib/esm/languageservice/jsonSchema.js +1 -7
- package/lib/esm/languageservice/jsonSchema.js.map +1 -1
- package/lib/esm/languageservice/parser/ast-converter.d.ts +2 -2
- package/lib/esm/languageservice/parser/ast-converter.js +15 -12
- package/lib/esm/languageservice/parser/ast-converter.js.map +1 -1
- package/lib/esm/languageservice/parser/custom-tag-provider.d.ts +1 -1
- package/lib/esm/languageservice/parser/custom-tag-provider.js +23 -11
- package/lib/esm/languageservice/parser/custom-tag-provider.js.map +1 -1
- package/lib/esm/languageservice/parser/isKubernetes.d.ts +2 -2
- package/lib/esm/languageservice/parser/isKubernetes.js.map +1 -1
- package/lib/esm/languageservice/parser/jsonDocument.d.ts +8 -6
- package/lib/esm/languageservice/parser/jsonDocument.js +3 -3
- package/lib/esm/languageservice/parser/jsonDocument.js.map +1 -1
- package/lib/esm/languageservice/parser/scalar-type.js.map +1 -1
- package/lib/esm/languageservice/parser/schemaValidation/baseValidator.d.ts +5 -4
- package/lib/esm/languageservice/parser/schemaValidation/baseValidator.js +25 -15
- package/lib/esm/languageservice/parser/schemaValidation/baseValidator.js.map +1 -1
- package/lib/esm/languageservice/parser/schemaValidation/draft04Validator.d.ts +2 -2
- package/lib/esm/languageservice/parser/schemaValidation/draft04Validator.js +3 -3
- package/lib/esm/languageservice/parser/schemaValidation/draft04Validator.js.map +1 -1
- package/lib/esm/languageservice/parser/schemaValidation/draft07Validator.d.ts +2 -2
- package/lib/esm/languageservice/parser/schemaValidation/draft07Validator.js +3 -3
- package/lib/esm/languageservice/parser/schemaValidation/draft07Validator.js.map +1 -1
- package/lib/esm/languageservice/parser/schemaValidation/draft2019Validator.d.ts +3 -3
- package/lib/esm/languageservice/parser/schemaValidation/draft2019Validator.js +3 -4
- package/lib/esm/languageservice/parser/schemaValidation/draft2019Validator.js.map +1 -1
- package/lib/esm/languageservice/parser/schemaValidation/draft2020Validator.d.ts +3 -3
- package/lib/esm/languageservice/parser/schemaValidation/draft2020Validator.js +3 -3
- package/lib/esm/languageservice/parser/schemaValidation/draft2020Validator.js.map +1 -1
- package/lib/esm/languageservice/parser/schemaValidation/validatorFactory.d.ts +3 -3
- package/lib/esm/languageservice/parser/schemaValidation/validatorFactory.js +7 -7
- package/lib/esm/languageservice/parser/schemaValidation/validatorFactory.js.map +1 -1
- package/lib/esm/languageservice/parser/yaml-documents.d.ts +11 -9
- package/lib/esm/languageservice/parser/yaml-documents.js +9 -1
- package/lib/esm/languageservice/parser/yaml-documents.js.map +1 -1
- package/lib/esm/languageservice/parser/yamlParser07.d.ts +1 -1
- package/lib/esm/languageservice/parser/yamlParser07.js +34 -2
- package/lib/esm/languageservice/parser/yamlParser07.js.map +1 -1
- package/lib/esm/languageservice/services/documentSymbols.d.ts +7 -7
- package/lib/esm/languageservice/services/documentSymbols.js +177 -25
- package/lib/esm/languageservice/services/documentSymbols.js.map +1 -1
- package/lib/esm/languageservice/services/dollarUtils.d.ts +8 -0
- package/lib/esm/languageservice/services/dollarUtils.js +30 -0
- package/lib/esm/languageservice/services/dollarUtils.js.map +1 -0
- package/lib/esm/languageservice/services/k8sSchemaUtil.d.ts +3 -3
- package/lib/esm/languageservice/services/k8sSchemaUtil.js +15 -7
- package/lib/esm/languageservice/services/k8sSchemaUtil.js.map +1 -1
- package/lib/esm/languageservice/services/modelineUtil.d.ts +2 -2
- package/lib/esm/languageservice/services/modelineUtil.js +2 -2
- package/lib/esm/languageservice/services/modelineUtil.js.map +1 -1
- package/lib/esm/languageservice/services/schemaRequestHandler.d.ts +11 -3
- package/lib/esm/languageservice/services/schemaRequestHandler.js +109 -13
- package/lib/esm/languageservice/services/schemaRequestHandler.js.map +1 -1
- package/lib/esm/languageservice/services/validation/map-key-order.d.ts +3 -3
- package/lib/esm/languageservice/services/validation/map-key-order.js.map +1 -1
- package/lib/esm/languageservice/services/validation/types.d.ts +3 -3
- package/lib/esm/languageservice/services/validation/unused-anchors.d.ts +3 -3
- package/lib/esm/languageservice/services/validation/unused-anchors.js.map +1 -1
- package/lib/esm/languageservice/services/validation/yaml-style.d.ts +4 -4
- package/lib/esm/languageservice/services/validation/yaml-style.js.map +1 -1
- package/lib/esm/languageservice/services/yamlCodeActions.d.ts +3 -3
- package/lib/esm/languageservice/services/yamlCodeActions.js +2 -2
- package/lib/esm/languageservice/services/yamlCodeActions.js.map +1 -1
- package/lib/esm/languageservice/services/yamlCodeLens.d.ts +3 -3
- package/lib/esm/languageservice/services/yamlCodeLens.js +20 -14
- package/lib/esm/languageservice/services/yamlCodeLens.js.map +1 -1
- package/lib/esm/languageservice/services/yamlCommands.d.ts +2 -2
- package/lib/esm/languageservice/services/yamlCommands.js +5 -5
- package/lib/esm/languageservice/services/yamlCommands.js.map +1 -1
- package/lib/esm/languageservice/services/yamlCompletion.d.ts +8 -8
- package/lib/esm/languageservice/services/yamlCompletion.js +41 -29
- package/lib/esm/languageservice/services/yamlCompletion.js.map +1 -1
- package/lib/esm/languageservice/services/yamlDefinition.d.ts +4 -4
- package/lib/esm/languageservice/services/yamlDefinition.js.map +1 -1
- package/lib/esm/languageservice/services/yamlFolding.d.ts +2 -2
- package/lib/esm/languageservice/services/yamlFolding.js.map +1 -1
- package/lib/esm/languageservice/services/yamlFormatter.d.ts +4 -3
- package/lib/esm/languageservice/services/yamlFormatter.js +1 -1
- package/lib/esm/languageservice/services/yamlFormatter.js.map +1 -1
- package/lib/esm/languageservice/services/yamlHover.d.ts +5 -5
- package/lib/esm/languageservice/services/yamlHover.js +95 -96
- package/lib/esm/languageservice/services/yamlHover.js.map +1 -1
- package/lib/esm/languageservice/services/yamlLinks.d.ts +3 -3
- package/lib/esm/languageservice/services/yamlLinks.js +74 -8
- package/lib/esm/languageservice/services/yamlLinks.js.map +1 -1
- package/lib/esm/languageservice/services/yamlOnTypeFormatting.d.ts +2 -2
- package/lib/esm/languageservice/services/yamlOnTypeFormatting.js +1 -1
- package/lib/esm/languageservice/services/yamlOnTypeFormatting.js.map +1 -1
- package/lib/esm/languageservice/services/yamlRename.d.ts +5 -4
- package/lib/esm/languageservice/services/yamlRename.js.map +1 -1
- package/lib/esm/languageservice/services/yamlSchemaService.d.ts +152 -18
- package/lib/esm/languageservice/services/yamlSchemaService.js +765 -283
- package/lib/esm/languageservice/services/yamlSchemaService.js.map +1 -1
- package/lib/esm/languageservice/services/yamlSelectionRanges.d.ts +3 -2
- package/lib/esm/languageservice/services/yamlSelectionRanges.js.map +1 -1
- package/lib/esm/languageservice/services/yamlValidation.d.ts +8 -6
- package/lib/esm/languageservice/services/yamlValidation.js +59 -27
- package/lib/esm/languageservice/services/yamlValidation.js.map +1 -1
- package/lib/esm/languageservice/utils/arrUtils.d.ts +1 -2
- package/lib/esm/languageservice/utils/arrUtils.js +0 -18
- package/lib/esm/languageservice/utils/arrUtils.js.map +1 -1
- package/lib/esm/languageservice/{parser → utils}/astNodeUtils.d.ts +1 -1
- package/lib/esm/languageservice/{parser → utils}/astNodeUtils.js +1 -1
- package/lib/esm/languageservice/utils/astNodeUtils.js.map +1 -0
- package/lib/esm/languageservice/utils/block-string-rewriter.d.ts +1 -1
- package/lib/esm/languageservice/utils/block-string-rewriter.js +0 -4
- package/lib/esm/languageservice/utils/block-string-rewriter.js.map +1 -1
- package/lib/esm/languageservice/utils/charCode.d.ts +180 -180
- package/lib/esm/languageservice/utils/customTags.d.ts +10 -0
- package/lib/esm/languageservice/utils/customTags.js +51 -0
- package/lib/esm/languageservice/utils/customTags.js.map +1 -0
- package/lib/esm/languageservice/utils/diagnostic-filter.js.map +1 -1
- package/lib/esm/languageservice/utils/filePatternAssociation.js +1 -1
- package/lib/esm/languageservice/utils/filePatternAssociation.js.map +1 -1
- package/lib/esm/languageservice/utils/flow-style-rewriter.d.ts +1 -1
- package/lib/esm/languageservice/utils/flow-style-rewriter.js.map +1 -1
- package/lib/esm/languageservice/utils/indentationGuesser.d.ts +1 -1
- package/lib/esm/languageservice/utils/indentationGuesser.js.map +1 -1
- package/lib/esm/languageservice/utils/json.js.map +1 -1
- package/lib/esm/languageservice/utils/objects.js +1 -2
- package/lib/esm/languageservice/utils/objects.js.map +1 -1
- package/lib/esm/languageservice/utils/parseUtils.d.ts +1 -1
- package/lib/esm/languageservice/utils/paths.d.ts +1 -1
- package/lib/esm/languageservice/utils/paths.js +4 -4
- package/lib/esm/languageservice/utils/paths.js.map +1 -1
- package/lib/esm/languageservice/utils/schemaUrls.d.ts +6 -6
- package/lib/esm/languageservice/utils/schemaUrls.js +22 -5
- package/lib/esm/languageservice/utils/schemaUrls.js.map +1 -1
- package/lib/esm/languageservice/utils/schemaUtils.d.ts +2 -2
- package/lib/esm/languageservice/utils/schemaUtils.js +20 -7
- package/lib/esm/languageservice/utils/schemaUtils.js.map +1 -1
- package/lib/esm/languageservice/utils/strings.d.ts +1 -0
- package/lib/esm/languageservice/utils/strings.js +22 -2
- package/lib/esm/languageservice/utils/strings.js.map +1 -1
- package/lib/esm/languageservice/utils/textBuffer.d.ts +3 -2
- package/lib/esm/languageservice/utils/textBuffer.js.map +1 -1
- package/lib/esm/languageservice/utils/yamlAstUtils.d.ts +4 -5
- package/lib/esm/languageservice/utils/yamlAstUtils.js.map +1 -1
- package/lib/esm/languageservice/utils/yamlScalar.js.map +1 -1
- package/lib/esm/languageservice/yamlLanguageService.d.ts +12 -11
- package/lib/esm/languageservice/yamlLanguageService.js +2 -2
- package/lib/esm/languageservice/yamlLanguageService.js.map +1 -1
- package/lib/esm/nodeTranslationSetup.d.ts +1 -1
- package/lib/esm/nodeTranslationSetup.js.map +1 -1
- package/lib/esm/requestTypes.d.ts +4 -4
- package/lib/esm/requestTypes.js.map +1 -1
- package/lib/esm/server.js.map +1 -1
- package/lib/esm/webworker/yamlServerMain.js.map +1 -1
- package/lib/esm/yamlServerInit.d.ts +4 -4
- package/lib/esm/yamlServerInit.js +2 -1
- package/lib/esm/yamlServerInit.js.map +1 -1
- package/lib/esm/yamlSettings.d.ts +11 -11
- package/lib/esm/yamlSettings.js +3 -1
- package/lib/esm/yamlSettings.js.map +1 -1
- package/lib/umd/commands.js +1 -1
- package/lib/umd/commands.js.map +1 -1
- package/lib/umd/index.d.ts +0 -1
- package/lib/umd/index.js +1 -4
- package/lib/umd/index.js.map +1 -1
- package/lib/umd/languageserver/commandExecutor.d.ts +1 -1
- package/lib/umd/languageserver/commandExecutor.js.map +1 -1
- package/lib/umd/languageserver/handlers/languageHandlers.d.ts +8 -9
- package/lib/umd/languageserver/handlers/languageHandlers.js +57 -12
- package/lib/umd/languageserver/handlers/languageHandlers.js.map +1 -1
- package/lib/umd/languageserver/handlers/notificationHandlers.d.ts +4 -4
- package/lib/umd/languageserver/handlers/requestHandlers.d.ts +2 -2
- package/lib/umd/languageserver/handlers/requestHandlers.js.map +1 -1
- package/lib/umd/languageserver/handlers/schemaSelectionHandlers.d.ts +4 -4
- package/lib/umd/languageserver/handlers/schemaSelectionHandlers.js +9 -11
- package/lib/umd/languageserver/handlers/schemaSelectionHandlers.js.map +1 -1
- package/lib/umd/languageserver/handlers/settingsHandlers.d.ts +8 -5
- package/lib/umd/languageserver/handlers/settingsHandlers.js +101 -38
- package/lib/umd/languageserver/handlers/settingsHandlers.js.map +1 -1
- package/lib/umd/languageserver/handlers/validationHandlers.d.ts +5 -5
- package/lib/umd/languageserver/handlers/validationHandlers.js +19 -23
- package/lib/umd/languageserver/handlers/validationHandlers.js.map +1 -1
- package/lib/umd/languageserver/handlers/workspaceHandlers.d.ts +2 -2
- package/lib/umd/languageserver/telemetry.d.ts +2 -2
- package/lib/umd/languageservice/jsonLanguageTypes.d.ts +302 -0
- package/lib/umd/languageservice/jsonLanguageTypes.js +109 -0
- package/lib/umd/languageservice/jsonLanguageTypes.js.map +1 -0
- package/lib/umd/languageservice/jsonSchema.d.ts +5 -9
- package/lib/umd/languageservice/jsonSchema.js +0 -8
- package/lib/umd/languageservice/jsonSchema.js.map +1 -1
- package/lib/umd/languageservice/parser/ast-converter.d.ts +2 -2
- package/lib/umd/languageservice/parser/ast-converter.js +18 -15
- package/lib/umd/languageservice/parser/ast-converter.js.map +1 -1
- package/lib/umd/languageservice/parser/custom-tag-provider.d.ts +1 -1
- package/lib/umd/languageservice/parser/custom-tag-provider.js +24 -13
- package/lib/umd/languageservice/parser/custom-tag-provider.js.map +1 -1
- package/lib/umd/languageservice/parser/isKubernetes.d.ts +2 -2
- package/lib/umd/languageservice/parser/isKubernetes.js +2 -3
- package/lib/umd/languageservice/parser/isKubernetes.js.map +1 -1
- package/lib/umd/languageservice/parser/jsonDocument.d.ts +8 -6
- package/lib/umd/languageservice/parser/jsonDocument.js +7 -7
- package/lib/umd/languageservice/parser/jsonDocument.js.map +1 -1
- package/lib/umd/languageservice/parser/scalar-type.js +1 -2
- package/lib/umd/languageservice/parser/scalar-type.js.map +1 -1
- package/lib/umd/languageservice/parser/schemaValidation/baseValidator.d.ts +5 -4
- package/lib/umd/languageservice/parser/schemaValidation/baseValidator.js +68 -25
- package/lib/umd/languageservice/parser/schemaValidation/baseValidator.js.map +1 -1
- package/lib/umd/languageservice/parser/schemaValidation/draft04Validator.d.ts +2 -2
- package/lib/umd/languageservice/parser/schemaValidation/draft04Validator.js +4 -4
- package/lib/umd/languageservice/parser/schemaValidation/draft04Validator.js.map +1 -1
- package/lib/umd/languageservice/parser/schemaValidation/draft07Validator.d.ts +2 -2
- package/lib/umd/languageservice/parser/schemaValidation/draft07Validator.js +4 -4
- package/lib/umd/languageservice/parser/schemaValidation/draft07Validator.js.map +1 -1
- package/lib/umd/languageservice/parser/schemaValidation/draft2019Validator.d.ts +3 -3
- package/lib/umd/languageservice/parser/schemaValidation/draft2019Validator.js +40 -8
- package/lib/umd/languageservice/parser/schemaValidation/draft2019Validator.js.map +1 -1
- package/lib/umd/languageservice/parser/schemaValidation/draft2020Validator.d.ts +3 -3
- package/lib/umd/languageservice/parser/schemaValidation/draft2020Validator.js +38 -5
- package/lib/umd/languageservice/parser/schemaValidation/draft2020Validator.js.map +1 -1
- package/lib/umd/languageservice/parser/schemaValidation/validatorFactory.d.ts +3 -3
- package/lib/umd/languageservice/parser/schemaValidation/validatorFactory.js +9 -10
- package/lib/umd/languageservice/parser/schemaValidation/validatorFactory.js.map +1 -1
- package/lib/umd/languageservice/parser/yaml-documents.d.ts +11 -9
- package/lib/umd/languageservice/parser/yaml-documents.js +11 -3
- package/lib/umd/languageservice/parser/yaml-documents.js.map +1 -1
- package/lib/umd/languageservice/parser/yamlParser07.d.ts +1 -1
- package/lib/umd/languageservice/parser/yamlParser07.js +36 -4
- package/lib/umd/languageservice/parser/yamlParser07.js.map +1 -1
- package/lib/umd/languageservice/services/documentSymbols.d.ts +7 -7
- package/lib/umd/languageservice/services/documentSymbols.js +178 -26
- package/lib/umd/languageservice/services/documentSymbols.js.map +1 -1
- package/lib/umd/languageservice/services/dollarUtils.d.ts +8 -0
- package/lib/umd/languageservice/services/dollarUtils.js +43 -0
- package/lib/umd/languageservice/services/dollarUtils.js.map +1 -0
- package/lib/umd/languageservice/services/k8sSchemaUtil.d.ts +3 -3
- package/lib/umd/languageservice/services/k8sSchemaUtil.js +19 -12
- package/lib/umd/languageservice/services/k8sSchemaUtil.js.map +1 -1
- package/lib/umd/languageservice/services/modelineUtil.d.ts +2 -2
- package/lib/umd/languageservice/services/modelineUtil.js +4 -5
- package/lib/umd/languageservice/services/modelineUtil.js.map +1 -1
- package/lib/umd/languageservice/services/schemaRequestHandler.d.ts +11 -3
- package/lib/umd/languageservice/services/schemaRequestHandler.js +110 -14
- package/lib/umd/languageservice/services/schemaRequestHandler.js.map +1 -1
- package/lib/umd/languageservice/services/validation/map-key-order.d.ts +3 -3
- package/lib/umd/languageservice/services/validation/map-key-order.js.map +1 -1
- package/lib/umd/languageservice/services/validation/types.d.ts +3 -3
- package/lib/umd/languageservice/services/validation/unused-anchors.d.ts +3 -3
- package/lib/umd/languageservice/services/validation/unused-anchors.js +34 -1
- package/lib/umd/languageservice/services/validation/unused-anchors.js.map +1 -1
- package/lib/umd/languageservice/services/validation/yaml-style.d.ts +4 -4
- package/lib/umd/languageservice/services/validation/yaml-style.js +34 -1
- package/lib/umd/languageservice/services/validation/yaml-style.js.map +1 -1
- package/lib/umd/languageservice/services/yamlCodeActions.d.ts +3 -3
- package/lib/umd/languageservice/services/yamlCodeActions.js +39 -6
- package/lib/umd/languageservice/services/yamlCodeActions.js.map +1 -1
- package/lib/umd/languageservice/services/yamlCodeLens.d.ts +3 -3
- package/lib/umd/languageservice/services/yamlCodeLens.js +20 -14
- package/lib/umd/languageservice/services/yamlCodeLens.js.map +1 -1
- package/lib/umd/languageservice/services/yamlCommands.d.ts +2 -2
- package/lib/umd/languageservice/services/yamlCommands.js +6 -7
- package/lib/umd/languageservice/services/yamlCommands.js.map +1 -1
- package/lib/umd/languageservice/services/yamlCompletion.d.ts +8 -8
- package/lib/umd/languageservice/services/yamlCompletion.js +75 -30
- package/lib/umd/languageservice/services/yamlCompletion.js.map +1 -1
- package/lib/umd/languageservice/services/yamlDefinition.d.ts +4 -4
- package/lib/umd/languageservice/services/yamlDefinition.js.map +1 -1
- package/lib/umd/languageservice/services/yamlFolding.d.ts +2 -2
- package/lib/umd/languageservice/services/yamlFolding.js +1 -2
- package/lib/umd/languageservice/services/yamlFolding.js.map +1 -1
- package/lib/umd/languageservice/services/yamlFormatter.d.ts +4 -3
- package/lib/umd/languageservice/services/yamlFormatter.js +36 -3
- package/lib/umd/languageservice/services/yamlFormatter.js.map +1 -1
- package/lib/umd/languageservice/services/yamlHover.d.ts +5 -5
- package/lib/umd/languageservice/services/yamlHover.js +131 -99
- package/lib/umd/languageservice/services/yamlHover.js.map +1 -1
- package/lib/umd/languageservice/services/yamlLinks.d.ts +3 -3
- package/lib/umd/languageservice/services/yamlLinks.js +75 -9
- package/lib/umd/languageservice/services/yamlLinks.js.map +1 -1
- package/lib/umd/languageservice/services/yamlOnTypeFormatting.d.ts +2 -2
- package/lib/umd/languageservice/services/yamlOnTypeFormatting.js +2 -3
- package/lib/umd/languageservice/services/yamlOnTypeFormatting.js.map +1 -1
- package/lib/umd/languageservice/services/yamlRename.d.ts +5 -4
- package/lib/umd/languageservice/services/yamlRename.js.map +1 -1
- package/lib/umd/languageservice/services/yamlSchemaService.d.ts +152 -18
- package/lib/umd/languageservice/services/yamlSchemaService.js +816 -293
- package/lib/umd/languageservice/services/yamlSchemaService.js.map +1 -1
- package/lib/umd/languageservice/services/yamlSelectionRanges.d.ts +3 -2
- package/lib/umd/languageservice/services/yamlSelectionRanges.js +1 -2
- package/lib/umd/languageservice/services/yamlSelectionRanges.js.map +1 -1
- package/lib/umd/languageservice/services/yamlValidation.d.ts +8 -6
- package/lib/umd/languageservice/services/yamlValidation.js +59 -27
- package/lib/umd/languageservice/services/yamlValidation.js.map +1 -1
- package/lib/umd/languageservice/utils/arrUtils.d.ts +1 -2
- package/lib/umd/languageservice/utils/arrUtils.js +4 -24
- package/lib/umd/languageservice/utils/arrUtils.js.map +1 -1
- package/lib/umd/languageservice/{parser → utils}/astNodeUtils.d.ts +1 -1
- package/lib/umd/languageservice/{parser → utils}/astNodeUtils.js +4 -5
- package/lib/umd/languageservice/utils/astNodeUtils.js.map +1 -0
- package/lib/umd/languageservice/utils/block-string-rewriter.d.ts +1 -1
- package/lib/umd/languageservice/utils/block-string-rewriter.js +0 -4
- package/lib/umd/languageservice/utils/block-string-rewriter.js.map +1 -1
- package/lib/umd/languageservice/utils/charCode.d.ts +180 -180
- package/lib/umd/languageservice/utils/customTags.d.ts +10 -0
- package/lib/umd/languageservice/utils/customTags.js +66 -0
- package/lib/umd/languageservice/utils/customTags.js.map +1 -0
- package/lib/umd/languageservice/utils/diagnostic-filter.js +4 -4
- package/lib/umd/languageservice/utils/diagnostic-filter.js.map +1 -1
- package/lib/umd/languageservice/utils/filePatternAssociation.js +1 -1
- package/lib/umd/languageservice/utils/filePatternAssociation.js.map +1 -1
- package/lib/umd/languageservice/utils/flow-style-rewriter.d.ts +1 -1
- package/lib/umd/languageservice/utils/flow-style-rewriter.js.map +1 -1
- package/lib/umd/languageservice/utils/indentationGuesser.d.ts +1 -1
- package/lib/umd/languageservice/utils/indentationGuesser.js +1 -2
- package/lib/umd/languageservice/utils/indentationGuesser.js.map +1 -1
- package/lib/umd/languageservice/utils/json.js +1 -2
- package/lib/umd/languageservice/utils/json.js.map +1 -1
- package/lib/umd/languageservice/utils/math.js +1 -2
- package/lib/umd/languageservice/utils/math.js.map +1 -1
- package/lib/umd/languageservice/utils/objects.js +8 -10
- package/lib/umd/languageservice/utils/objects.js.map +1 -1
- package/lib/umd/languageservice/utils/parseUtils.d.ts +1 -1
- package/lib/umd/languageservice/utils/paths.d.ts +1 -1
- package/lib/umd/languageservice/utils/paths.js +4 -4
- package/lib/umd/languageservice/utils/paths.js.map +1 -1
- package/lib/umd/languageservice/utils/schemaUrls.d.ts +6 -6
- package/lib/umd/languageservice/utils/schemaUrls.js +60 -9
- package/lib/umd/languageservice/utils/schemaUrls.js.map +1 -1
- package/lib/umd/languageservice/utils/schemaUtils.d.ts +2 -2
- package/lib/umd/languageservice/utils/schemaUtils.js +59 -14
- package/lib/umd/languageservice/utils/schemaUtils.js.map +1 -1
- package/lib/umd/languageservice/utils/strings.d.ts +1 -0
- package/lib/umd/languageservice/utils/strings.js +30 -10
- package/lib/umd/languageservice/utils/strings.js.map +1 -1
- package/lib/umd/languageservice/utils/textBuffer.d.ts +3 -2
- package/lib/umd/languageservice/utils/textBuffer.js.map +1 -1
- package/lib/umd/languageservice/utils/yamlAstUtils.d.ts +4 -5
- package/lib/umd/languageservice/utils/yamlAstUtils.js +5 -6
- package/lib/umd/languageservice/utils/yamlAstUtils.js.map +1 -1
- package/lib/umd/languageservice/utils/yamlScalar.js +1 -2
- package/lib/umd/languageservice/utils/yamlScalar.js.map +1 -1
- package/lib/umd/languageservice/yamlLanguageService.d.ts +12 -11
- package/lib/umd/languageservice/yamlLanguageService.js +4 -4
- package/lib/umd/languageservice/yamlLanguageService.js.map +1 -1
- package/lib/umd/nodeTranslationSetup.d.ts +1 -1
- package/lib/umd/nodeTranslationSetup.js +36 -4
- package/lib/umd/nodeTranslationSetup.js.map +1 -1
- package/lib/umd/requestTypes.d.ts +4 -4
- package/lib/umd/requestTypes.js +10 -10
- package/lib/umd/requestTypes.js.map +1 -1
- package/lib/umd/server.js.map +1 -1
- package/lib/umd/webworker/yamlServerMain.js +34 -1
- package/lib/umd/webworker/yamlServerMain.js.map +1 -1
- package/lib/umd/yamlServerInit.d.ts +4 -4
- package/lib/umd/yamlServerInit.js +1 -0
- package/lib/umd/yamlServerInit.js.map +1 -1
- package/lib/umd/yamlSettings.d.ts +11 -11
- package/lib/umd/yamlSettings.js +3 -1
- package/lib/umd/yamlSettings.js.map +1 -1
- package/out/server/src/commands.js +1 -1
- package/out/server/src/commands.js.map +1 -1
- package/out/server/src/index.d.ts +0 -1
- package/out/server/src/index.js +0 -3
- package/out/server/src/index.js.map +1 -1
- package/out/server/src/languageserver/commandExecutor.d.ts +1 -1
- package/out/server/src/languageserver/commandExecutor.js.map +1 -1
- package/out/server/src/languageserver/handlers/languageHandlers.d.ts +8 -9
- package/out/server/src/languageserver/handlers/languageHandlers.js +57 -12
- package/out/server/src/languageserver/handlers/languageHandlers.js.map +1 -1
- package/out/server/src/languageserver/handlers/notificationHandlers.d.ts +4 -4
- package/out/server/src/languageserver/handlers/requestHandlers.d.ts +2 -2
- package/out/server/src/languageserver/handlers/requestHandlers.js.map +1 -1
- package/out/server/src/languageserver/handlers/schemaSelectionHandlers.d.ts +4 -4
- package/out/server/src/languageserver/handlers/schemaSelectionHandlers.js +8 -10
- package/out/server/src/languageserver/handlers/schemaSelectionHandlers.js.map +1 -1
- package/out/server/src/languageserver/handlers/settingsHandlers.d.ts +8 -5
- package/out/server/src/languageserver/handlers/settingsHandlers.js +100 -37
- package/out/server/src/languageserver/handlers/settingsHandlers.js.map +1 -1
- package/out/server/src/languageserver/handlers/validationHandlers.d.ts +5 -5
- package/out/server/src/languageserver/handlers/validationHandlers.js +19 -23
- package/out/server/src/languageserver/handlers/validationHandlers.js.map +1 -1
- package/out/server/src/languageserver/handlers/workspaceHandlers.d.ts +2 -2
- package/out/server/src/languageserver/telemetry.d.ts +2 -2
- package/out/server/src/languageservice/jsonLanguageTypes.d.ts +302 -0
- package/out/server/src/languageservice/jsonLanguageTypes.js +99 -0
- package/out/server/src/languageservice/jsonLanguageTypes.js.map +1 -0
- package/out/server/src/languageservice/jsonSchema.d.ts +5 -9
- package/out/server/src/languageservice/jsonSchema.js +0 -8
- package/out/server/src/languageservice/jsonSchema.js.map +1 -1
- package/out/server/src/languageservice/parser/ast-converter.d.ts +2 -2
- package/out/server/src/languageservice/parser/ast-converter.js +17 -14
- package/out/server/src/languageservice/parser/ast-converter.js.map +1 -1
- package/out/server/src/languageservice/parser/custom-tag-provider.d.ts +1 -1
- package/out/server/src/languageservice/parser/custom-tag-provider.js +23 -12
- package/out/server/src/languageservice/parser/custom-tag-provider.js.map +1 -1
- package/out/server/src/languageservice/parser/isKubernetes.d.ts +2 -2
- package/out/server/src/languageservice/parser/isKubernetes.js +2 -3
- package/out/server/src/languageservice/parser/isKubernetes.js.map +1 -1
- package/out/server/src/languageservice/parser/jsonDocument.d.ts +8 -6
- package/out/server/src/languageservice/parser/jsonDocument.js +6 -6
- package/out/server/src/languageservice/parser/jsonDocument.js.map +1 -1
- package/out/server/src/languageservice/parser/scalar-type.js +1 -2
- package/out/server/src/languageservice/parser/scalar-type.js.map +1 -1
- package/out/server/src/languageservice/parser/schemaValidation/baseValidator.d.ts +5 -4
- package/out/server/src/languageservice/parser/schemaValidation/baseValidator.js +67 -24
- package/out/server/src/languageservice/parser/schemaValidation/baseValidator.js.map +1 -1
- package/out/server/src/languageservice/parser/schemaValidation/draft04Validator.d.ts +2 -2
- package/out/server/src/languageservice/parser/schemaValidation/draft04Validator.js +3 -3
- package/out/server/src/languageservice/parser/schemaValidation/draft04Validator.js.map +1 -1
- package/out/server/src/languageservice/parser/schemaValidation/draft07Validator.d.ts +2 -2
- package/out/server/src/languageservice/parser/schemaValidation/draft07Validator.js +3 -3
- package/out/server/src/languageservice/parser/schemaValidation/draft07Validator.js.map +1 -1
- package/out/server/src/languageservice/parser/schemaValidation/draft2019Validator.d.ts +3 -3
- package/out/server/src/languageservice/parser/schemaValidation/draft2019Validator.js +39 -7
- package/out/server/src/languageservice/parser/schemaValidation/draft2019Validator.js.map +1 -1
- package/out/server/src/languageservice/parser/schemaValidation/draft2020Validator.d.ts +3 -3
- package/out/server/src/languageservice/parser/schemaValidation/draft2020Validator.js +37 -4
- package/out/server/src/languageservice/parser/schemaValidation/draft2020Validator.js.map +1 -1
- package/out/server/src/languageservice/parser/schemaValidation/validatorFactory.d.ts +3 -3
- package/out/server/src/languageservice/parser/schemaValidation/validatorFactory.js +8 -9
- package/out/server/src/languageservice/parser/schemaValidation/validatorFactory.js.map +1 -1
- package/out/server/src/languageservice/parser/yaml-documents.d.ts +11 -9
- package/out/server/src/languageservice/parser/yaml-documents.js +10 -2
- package/out/server/src/languageservice/parser/yaml-documents.js.map +1 -1
- package/out/server/src/languageservice/parser/yamlParser07.d.ts +1 -1
- package/out/server/src/languageservice/parser/yamlParser07.js +36 -4
- package/out/server/src/languageservice/parser/yamlParser07.js.map +1 -1
- package/out/server/src/languageservice/services/documentSymbols.d.ts +7 -7
- package/out/server/src/languageservice/services/documentSymbols.js +177 -25
- package/out/server/src/languageservice/services/documentSymbols.js.map +1 -1
- package/out/server/src/languageservice/services/dollarUtils.d.ts +8 -0
- package/out/server/src/languageservice/services/dollarUtils.js +33 -0
- package/out/server/src/languageservice/services/dollarUtils.js.map +1 -0
- package/out/server/src/languageservice/services/k8sSchemaUtil.d.ts +3 -3
- package/out/server/src/languageservice/services/k8sSchemaUtil.js +18 -11
- package/out/server/src/languageservice/services/k8sSchemaUtil.js.map +1 -1
- package/out/server/src/languageservice/services/modelineUtil.d.ts +2 -2
- package/out/server/src/languageservice/services/modelineUtil.js +4 -5
- package/out/server/src/languageservice/services/modelineUtil.js.map +1 -1
- package/out/server/src/languageservice/services/schemaRequestHandler.d.ts +11 -3
- package/out/server/src/languageservice/services/schemaRequestHandler.js +109 -13
- package/out/server/src/languageservice/services/schemaRequestHandler.js.map +1 -1
- package/out/server/src/languageservice/services/validation/map-key-order.d.ts +3 -3
- package/out/server/src/languageservice/services/validation/map-key-order.js.map +1 -1
- package/out/server/src/languageservice/services/validation/types.d.ts +3 -3
- package/out/server/src/languageservice/services/validation/unused-anchors.d.ts +3 -3
- package/out/server/src/languageservice/services/validation/unused-anchors.js +34 -1
- package/out/server/src/languageservice/services/validation/unused-anchors.js.map +1 -1
- package/out/server/src/languageservice/services/validation/yaml-style.d.ts +4 -4
- package/out/server/src/languageservice/services/validation/yaml-style.js +34 -1
- package/out/server/src/languageservice/services/validation/yaml-style.js.map +1 -1
- package/out/server/src/languageservice/services/yamlCodeActions.d.ts +3 -3
- package/out/server/src/languageservice/services/yamlCodeActions.js +38 -5
- package/out/server/src/languageservice/services/yamlCodeActions.js.map +1 -1
- package/out/server/src/languageservice/services/yamlCodeLens.d.ts +3 -3
- package/out/server/src/languageservice/services/yamlCodeLens.js +20 -14
- package/out/server/src/languageservice/services/yamlCodeLens.js.map +1 -1
- package/out/server/src/languageservice/services/yamlCommands.d.ts +2 -2
- package/out/server/src/languageservice/services/yamlCommands.js +6 -7
- package/out/server/src/languageservice/services/yamlCommands.js.map +1 -1
- package/out/server/src/languageservice/services/yamlCompletion.d.ts +8 -8
- package/out/server/src/languageservice/services/yamlCompletion.js +74 -29
- package/out/server/src/languageservice/services/yamlCompletion.js.map +1 -1
- package/out/server/src/languageservice/services/yamlDefinition.d.ts +4 -4
- package/out/server/src/languageservice/services/yamlDefinition.js.map +1 -1
- package/out/server/src/languageservice/services/yamlFolding.d.ts +2 -2
- package/out/server/src/languageservice/services/yamlFolding.js +1 -2
- package/out/server/src/languageservice/services/yamlFolding.js.map +1 -1
- package/out/server/src/languageservice/services/yamlFormatter.d.ts +4 -3
- package/out/server/src/languageservice/services/yamlFormatter.js +36 -3
- package/out/server/src/languageservice/services/yamlFormatter.js.map +1 -1
- package/out/server/src/languageservice/services/yamlHover.d.ts +5 -5
- package/out/server/src/languageservice/services/yamlHover.js +130 -98
- package/out/server/src/languageservice/services/yamlHover.js.map +1 -1
- package/out/server/src/languageservice/services/yamlLinks.d.ts +3 -3
- package/out/server/src/languageservice/services/yamlLinks.js +74 -8
- package/out/server/src/languageservice/services/yamlLinks.js.map +1 -1
- package/out/server/src/languageservice/services/yamlOnTypeFormatting.d.ts +2 -2
- package/out/server/src/languageservice/services/yamlOnTypeFormatting.js +2 -3
- package/out/server/src/languageservice/services/yamlOnTypeFormatting.js.map +1 -1
- package/out/server/src/languageservice/services/yamlRename.d.ts +5 -4
- package/out/server/src/languageservice/services/yamlRename.js.map +1 -1
- package/out/server/src/languageservice/services/yamlSchemaService.d.ts +152 -18
- package/out/server/src/languageservice/services/yamlSchemaService.js +815 -292
- package/out/server/src/languageservice/services/yamlSchemaService.js.map +1 -1
- package/out/server/src/languageservice/services/yamlSelectionRanges.d.ts +3 -2
- package/out/server/src/languageservice/services/yamlSelectionRanges.js +1 -2
- package/out/server/src/languageservice/services/yamlSelectionRanges.js.map +1 -1
- package/out/server/src/languageservice/services/yamlValidation.d.ts +8 -6
- package/out/server/src/languageservice/services/yamlValidation.js +58 -26
- package/out/server/src/languageservice/services/yamlValidation.js.map +1 -1
- package/out/server/src/languageservice/utils/arrUtils.d.ts +1 -2
- package/out/server/src/languageservice/utils/arrUtils.js +4 -24
- package/out/server/src/languageservice/utils/arrUtils.js.map +1 -1
- package/out/server/src/languageservice/{parser → utils}/astNodeUtils.d.ts +1 -1
- package/out/server/src/languageservice/{parser → utils}/astNodeUtils.js +4 -5
- package/out/server/src/languageservice/utils/astNodeUtils.js.map +1 -0
- package/out/server/src/languageservice/utils/block-string-rewriter.d.ts +1 -1
- package/out/server/src/languageservice/utils/block-string-rewriter.js +0 -4
- package/out/server/src/languageservice/utils/block-string-rewriter.js.map +1 -1
- package/out/server/src/languageservice/utils/charCode.d.ts +180 -180
- package/out/server/src/languageservice/utils/customTags.d.ts +10 -0
- package/out/server/src/languageservice/utils/customTags.js +56 -0
- package/out/server/src/languageservice/utils/customTags.js.map +1 -0
- package/out/server/src/languageservice/utils/diagnostic-filter.js +4 -4
- package/out/server/src/languageservice/utils/diagnostic-filter.js.map +1 -1
- package/out/server/src/languageservice/utils/filePatternAssociation.js +1 -1
- package/out/server/src/languageservice/utils/filePatternAssociation.js.map +1 -1
- package/out/server/src/languageservice/utils/flow-style-rewriter.d.ts +1 -1
- package/out/server/src/languageservice/utils/flow-style-rewriter.js.map +1 -1
- package/out/server/src/languageservice/utils/indentationGuesser.d.ts +1 -1
- package/out/server/src/languageservice/utils/indentationGuesser.js +1 -2
- package/out/server/src/languageservice/utils/indentationGuesser.js.map +1 -1
- package/out/server/src/languageservice/utils/json.js +1 -2
- package/out/server/src/languageservice/utils/json.js.map +1 -1
- package/out/server/src/languageservice/utils/math.js +1 -2
- package/out/server/src/languageservice/utils/math.js.map +1 -1
- package/out/server/src/languageservice/utils/objects.js +8 -10
- package/out/server/src/languageservice/utils/objects.js.map +1 -1
- package/out/server/src/languageservice/utils/parseUtils.d.ts +1 -1
- package/out/server/src/languageservice/utils/paths.d.ts +1 -1
- package/out/server/src/languageservice/utils/paths.js +4 -4
- package/out/server/src/languageservice/utils/paths.js.map +1 -1
- package/out/server/src/languageservice/utils/schemaUrls.d.ts +6 -6
- package/out/server/src/languageservice/utils/schemaUrls.js +59 -8
- package/out/server/src/languageservice/utils/schemaUrls.js.map +1 -1
- package/out/server/src/languageservice/utils/schemaUtils.d.ts +2 -2
- package/out/server/src/languageservice/utils/schemaUtils.js +59 -14
- package/out/server/src/languageservice/utils/schemaUtils.js.map +1 -1
- package/out/server/src/languageservice/utils/strings.d.ts +1 -0
- package/out/server/src/languageservice/utils/strings.js +30 -10
- package/out/server/src/languageservice/utils/strings.js.map +1 -1
- package/out/server/src/languageservice/utils/textBuffer.d.ts +3 -2
- package/out/server/src/languageservice/utils/textBuffer.js.map +1 -1
- package/out/server/src/languageservice/utils/yamlAstUtils.d.ts +4 -5
- package/out/server/src/languageservice/utils/yamlAstUtils.js +5 -6
- package/out/server/src/languageservice/utils/yamlAstUtils.js.map +1 -1
- package/out/server/src/languageservice/utils/yamlScalar.js +1 -2
- package/out/server/src/languageservice/utils/yamlScalar.js.map +1 -1
- package/out/server/src/languageservice/yamlLanguageService.d.ts +12 -11
- package/out/server/src/languageservice/yamlLanguageService.js +4 -4
- package/out/server/src/languageservice/yamlLanguageService.js.map +1 -1
- package/out/server/src/nodeTranslationSetup.d.ts +1 -1
- package/out/server/src/nodeTranslationSetup.js +36 -4
- package/out/server/src/nodeTranslationSetup.js.map +1 -1
- package/out/server/src/requestTypes.d.ts +4 -4
- package/out/server/src/requestTypes.js +10 -10
- package/out/server/src/requestTypes.js.map +1 -1
- package/out/server/src/server.js.map +1 -1
- package/out/server/src/webworker/yamlServerMain.js +34 -1
- package/out/server/src/webworker/yamlServerMain.js.map +1 -1
- package/out/server/src/yamlServerInit.d.ts +4 -4
- package/out/server/src/yamlServerInit.js +1 -0
- package/out/server/src/yamlServerInit.js.map +1 -1
- package/out/server/src/yamlSettings.d.ts +11 -11
- package/out/server/src/yamlSettings.js +3 -1
- package/out/server/src/yamlSettings.js.map +1 -1
- package/out/server/test/arrUtils.test.js +15 -12
- package/out/server/test/arrUtils.test.js.map +1 -1
- package/out/server/test/astUtils.test.js +34 -1
- package/out/server/test/astUtils.test.js.map +1 -1
- package/out/server/test/autoCompletion.test.js +591 -663
- package/out/server/test/autoCompletion.test.js.map +1 -1
- package/out/server/test/autoCompletionFix.test.js +214 -3
- package/out/server/test/autoCompletionFix.test.js.map +1 -1
- package/out/server/test/bundlel10n.test.js +41 -5
- package/out/server/test/bundlel10n.test.js.map +1 -1
- package/out/server/test/code-action-schema.test.js +0 -4
- package/out/server/test/code-action-schema.test.js.map +1 -1
- package/out/server/test/customTags.test.js +28 -44
- package/out/server/test/customTags.test.js.map +1 -1
- package/out/server/test/defaultSnippets.test.js +212 -290
- package/out/server/test/defaultSnippets.test.js.map +1 -1
- package/out/server/test/diagnostic-filter.test.js.map +1 -1
- package/out/server/test/documentSymbols.test.js +72 -71
- package/out/server/test/documentSymbols.test.js.map +1 -1
- package/out/server/test/findLinks.test.js +19 -20
- package/out/server/test/findLinks.test.js.map +1 -1
- package/out/server/test/formatter.test.js +89 -24
- package/out/server/test/formatter.test.js.map +1 -1
- package/out/server/test/hover.test.js +118 -115
- package/out/server/test/hover.test.js.map +1 -1
- package/out/server/test/integration.test.js +79 -152
- package/out/server/test/integration.test.js.map +1 -1
- package/out/server/test/invalid-metaschema.test.js +34 -1
- package/out/server/test/invalid-metaschema.test.js.map +1 -1
- package/out/server/test/multipleDocuments.test.js +53 -33
- package/out/server/test/multipleDocuments.test.js.map +1 -1
- package/out/server/test/objects.test.js +18 -15
- package/out/server/test/objects.test.js.map +1 -1
- package/out/server/test/paths.test.js +61 -43
- package/out/server/test/paths.test.js.map +1 -1
- package/out/server/test/schema.test.js +283 -240
- package/out/server/test/schema.test.js.map +1 -1
- package/out/server/test/schema2019Validation.test.js +3 -6
- package/out/server/test/schema2019Validation.test.js.map +1 -1
- package/out/server/test/schema2020Validation.test.js +3 -6
- package/out/server/test/schema2020Validation.test.js.map +1 -1
- package/out/server/test/schemaRequestHandler.test.js +184 -5
- package/out/server/test/schemaRequestHandler.test.js.map +1 -1
- package/out/server/test/schemaSelectionHandlers.test.js +132 -4
- package/out/server/test/schemaSelectionHandlers.test.js.map +1 -1
- package/out/server/test/schemaValidation.test.js +548 -391
- package/out/server/test/schemaValidation.test.js.map +1 -1
- package/out/server/test/settingsHandlers.test.js +270 -28
- package/out/server/test/settingsHandlers.test.js.map +1 -1
- package/out/server/test/strings.test.js +14 -17
- package/out/server/test/strings.test.js.map +1 -1
- package/out/server/test/telemetry.test.js +40 -4
- package/out/server/test/telemetry.test.js.map +1 -1
- package/out/server/test/textBuffer.test.js +11 -8
- package/out/server/test/textBuffer.test.js.map +1 -1
- package/out/server/test/utils/errorMessages.js +2 -2
- package/out/server/test/utils/errorMessages.js.map +1 -1
- package/out/server/test/utils/serviceSetup.d.ts +2 -2
- package/out/server/test/utils/testHelper.d.ts +5 -5
- package/out/server/test/utils/testHelper.js +43 -10
- package/out/server/test/utils/testHelper.js.map +1 -1
- package/out/server/test/utils/testsTypes.d.ts +4 -4
- package/out/server/test/utils/testsTypes.js +0 -1
- package/out/server/test/utils/testsTypes.js.map +1 -1
- package/out/server/test/utils/verifyError.d.ts +2 -1
- package/out/server/test/utils/verifyError.js +10 -11
- package/out/server/test/utils/verifyError.js.map +1 -1
- package/out/server/test/yaml-documents.test.js +41 -5
- package/out/server/test/yaml-documents.test.js.map +1 -1
- package/out/server/test/yamlCodeActions.test.js +45 -9
- package/out/server/test/yamlCodeActions.test.js.map +1 -1
- package/out/server/test/yamlCodeLens.test.js +134 -16
- package/out/server/test/yamlCodeLens.test.js.map +1 -1
- package/out/server/test/yamlCommands.test.js +61 -4
- package/out/server/test/yamlCommands.test.js.map +1 -1
- package/out/server/test/yamlLanguageService.test.js +2 -2
- package/out/server/test/yamlLanguageService.test.js.map +1 -1
- package/out/server/test/yamlOnTypeFormatting.test.js +8 -0
- package/out/server/test/yamlOnTypeFormatting.test.js.map +1 -1
- package/out/server/test/yamlParser.test.js +79 -76
- package/out/server/test/yamlParser.test.js.map +1 -1
- package/out/server/test/yamlRename.test.js.map +1 -1
- package/out/server/test/yamlSchema.test.js +133 -9
- package/out/server/test/yamlSchema.test.js.map +1 -1
- package/out/server/test/yamlSchemaService.test.js +775 -37
- package/out/server/test/yamlSchemaService.test.js.map +1 -1
- package/out/server/test/yamlSelectionRanges.test.js.map +1 -1
- package/out/server/test/yamlValidation.test.js +34 -5
- package/out/server/test/yamlValidation.test.js.map +1 -1
- package/package.json +16 -17
- package/scripts/check-dependencies.js +1 -1
- package/tsconfig.esm.json +3 -7
- package/tsconfig.umd.json +4 -6
- package/eslint-result.sarif +0 -4056
- package/lib/esm/languageservice/jsonASTTypes.d.ts +0 -49
- package/lib/esm/languageservice/jsonASTTypes.js +0 -6
- package/lib/esm/languageservice/jsonASTTypes.js.map +0 -1
- package/lib/esm/languageservice/parser/astNodeUtils.js.map +0 -1
- package/lib/esm/languageservice/utils/documentPositionCalculator.d.ts +0 -5
- package/lib/esm/languageservice/utils/documentPositionCalculator.js +0 -56
- package/lib/esm/languageservice/utils/documentPositionCalculator.js.map +0 -1
- package/lib/umd/languageservice/jsonASTTypes.d.ts +0 -49
- package/lib/umd/languageservice/jsonASTTypes.js +0 -17
- package/lib/umd/languageservice/jsonASTTypes.js.map +0 -1
- package/lib/umd/languageservice/parser/astNodeUtils.js.map +0 -1
- package/lib/umd/languageservice/utils/documentPositionCalculator.d.ts +0 -5
- package/lib/umd/languageservice/utils/documentPositionCalculator.js +0 -73
- package/lib/umd/languageservice/utils/documentPositionCalculator.js.map +0 -1
- package/out/server/src/languageservice/jsonASTTypes.d.ts +0 -49
- package/out/server/src/languageservice/jsonASTTypes.js +0 -7
- package/out/server/src/languageservice/jsonASTTypes.js.map +0 -1
- package/out/server/src/languageservice/parser/astNodeUtils.js.map +0 -1
- package/out/server/src/languageservice/utils/documentPositionCalculator.d.ts +0 -5
- package/out/server/src/languageservice/utils/documentPositionCalculator.js +0 -63
- package/out/server/src/languageservice/utils/documentPositionCalculator.js.map +0 -1
- package/out/server/test/documentPositionCalculator.test.d.ts +0 -1
- package/out/server/test/documentPositionCalculator.test.js +0 -69
- package/out/server/test/documentPositionCalculator.test.js.map +0 -1
- package/out/server/test/jsonParser.test.d.ts +0 -1
- package/out/server/test/jsonParser.test.js +0 -1682
- package/out/server/test/jsonParser.test.js.map +0 -1
|
@@ -1,1682 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Red Hat, Inc. All rights reserved.
|
|
4
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
6
|
-
*--------------------------------------------------------------------------------------------*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
const assert = require("assert");
|
|
9
|
-
const astNodeUtils_1 = require("../src/languageservice/parser/astNodeUtils");
|
|
10
|
-
const vscode_json_languageservice_1 = require("vscode-json-languageservice");
|
|
11
|
-
const vscode_languageserver_types_1 = require("vscode-languageserver-types");
|
|
12
|
-
describe('JSON Parser', () => {
|
|
13
|
-
function isValid(json) {
|
|
14
|
-
const { jsonDoc } = toDocument(json);
|
|
15
|
-
assert.equal(jsonDoc.syntaxErrors.length, 0);
|
|
16
|
-
}
|
|
17
|
-
function isInvalid(json, ...expectedErrors) {
|
|
18
|
-
const { jsonDoc } = toDocument(json);
|
|
19
|
-
if (expectedErrors.length === 0) {
|
|
20
|
-
assert.ok(jsonDoc.syntaxErrors.length > 0, json);
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
assert.deepEqual(jsonDoc.syntaxErrors.map((e) => e.code), expectedErrors, json);
|
|
24
|
-
}
|
|
25
|
-
// these should be caught by the parser, not the last-ditch guard
|
|
26
|
-
assert.notEqual(jsonDoc.syntaxErrors[0].message, 'Invalid JSON', json);
|
|
27
|
-
}
|
|
28
|
-
function toDocument(text) {
|
|
29
|
-
const textDoc = vscode_languageserver_types_1.TextDocument.create('foo://bar/file.json', 'json', 0, text);
|
|
30
|
-
const ls = (0, vscode_json_languageservice_1.getLanguageService)({});
|
|
31
|
-
const jsonDoc = ls.parseJSONDocument(textDoc);
|
|
32
|
-
return { textDoc, jsonDoc };
|
|
33
|
-
}
|
|
34
|
-
function toRange(text, offset, length) {
|
|
35
|
-
const textDoc = vscode_languageserver_types_1.TextDocument.create('foo://bar/file.json', 'json', 0, text);
|
|
36
|
-
return vscode_languageserver_types_1.Range.create(textDoc.positionAt(offset), textDoc.positionAt(offset + length));
|
|
37
|
-
}
|
|
38
|
-
function validate(text, schema) {
|
|
39
|
-
const { textDoc, jsonDoc } = toDocument(text);
|
|
40
|
-
return jsonDoc.validate(textDoc, schema);
|
|
41
|
-
}
|
|
42
|
-
function assertObject(node, expectedProperties) {
|
|
43
|
-
assert.equal(node.type, 'object');
|
|
44
|
-
assert.equal(node.properties.length, expectedProperties.length);
|
|
45
|
-
const keyList = node.properties.map((p) => p.keyNode.value);
|
|
46
|
-
assert.deepEqual(keyList, expectedProperties);
|
|
47
|
-
}
|
|
48
|
-
it('Invalid body', function () {
|
|
49
|
-
const { jsonDoc } = toDocument('*');
|
|
50
|
-
assert.equal(jsonDoc.syntaxErrors.length, 1);
|
|
51
|
-
isInvalid('{}[]');
|
|
52
|
-
});
|
|
53
|
-
it('Trailing Whitespace', function () {
|
|
54
|
-
isValid('{}\n\n');
|
|
55
|
-
});
|
|
56
|
-
it('No content', function () {
|
|
57
|
-
isValid('');
|
|
58
|
-
isValid(' ');
|
|
59
|
-
isValid('\n\n');
|
|
60
|
-
isValid('/*hello*/ ');
|
|
61
|
-
});
|
|
62
|
-
it('Objects', function () {
|
|
63
|
-
isValid('{}');
|
|
64
|
-
isValid('{"key": "value"}');
|
|
65
|
-
isValid('{"key1": true, "key2": 3, "key3": [null], "key4": { "nested": {}}}');
|
|
66
|
-
isValid('{"constructor": true }');
|
|
67
|
-
isInvalid('{');
|
|
68
|
-
isInvalid('{3:3}');
|
|
69
|
-
isInvalid("{'key': 3}");
|
|
70
|
-
isInvalid('{"key" 3}', vscode_json_languageservice_1.ErrorCode.ColonExpected);
|
|
71
|
-
isInvalid('{"key":3 "key2": 4}', vscode_json_languageservice_1.ErrorCode.CommaExpected);
|
|
72
|
-
isInvalid('{"key":42, }', vscode_json_languageservice_1.ErrorCode.TrailingComma);
|
|
73
|
-
isInvalid('{"key:42', vscode_json_languageservice_1.ErrorCode.UnexpectedEndOfString, vscode_json_languageservice_1.ErrorCode.ColonExpected);
|
|
74
|
-
});
|
|
75
|
-
it('Arrays', function () {
|
|
76
|
-
isValid('[]');
|
|
77
|
-
isValid('[1, 2]');
|
|
78
|
-
isValid('[1, "string", false, {}, [null]]');
|
|
79
|
-
isInvalid('[');
|
|
80
|
-
isInvalid('[,]', vscode_json_languageservice_1.ErrorCode.ValueExpected);
|
|
81
|
-
isInvalid('[1 2]', vscode_json_languageservice_1.ErrorCode.CommaExpected);
|
|
82
|
-
isInvalid('[true false]', vscode_json_languageservice_1.ErrorCode.CommaExpected);
|
|
83
|
-
isInvalid('[1, ]', vscode_json_languageservice_1.ErrorCode.TrailingComma);
|
|
84
|
-
isInvalid('[[]', vscode_json_languageservice_1.ErrorCode.CommaOrCloseBacketExpected);
|
|
85
|
-
isInvalid('["something"');
|
|
86
|
-
isInvalid('[magic]');
|
|
87
|
-
});
|
|
88
|
-
it('Strings', function () {
|
|
89
|
-
isValid('["string"]');
|
|
90
|
-
isValid('["\\"\\\\\\/\\b\\f\\n\\r\\t\\u1234\\u12AB"]');
|
|
91
|
-
isValid('["\\\\"]');
|
|
92
|
-
isInvalid('["');
|
|
93
|
-
isInvalid('["]');
|
|
94
|
-
isInvalid('["\\z"]');
|
|
95
|
-
isInvalid('["\\u"]');
|
|
96
|
-
isInvalid('["\\u123"]');
|
|
97
|
-
isInvalid('["\\u123Z"]');
|
|
98
|
-
isInvalid("['string']");
|
|
99
|
-
isInvalid('"\tabc"', vscode_json_languageservice_1.ErrorCode.InvalidCharacter);
|
|
100
|
-
});
|
|
101
|
-
it('Numbers', function () {
|
|
102
|
-
isValid('[0, -1, 186.1, 0.123, -1.583e+4, 1.583E-4, 5e8]');
|
|
103
|
-
isInvalid('[+1]');
|
|
104
|
-
isInvalid('[01]');
|
|
105
|
-
isInvalid('[1.]');
|
|
106
|
-
isInvalid('[1.1+3]');
|
|
107
|
-
isInvalid('[1.4e]');
|
|
108
|
-
isInvalid('[-A]');
|
|
109
|
-
});
|
|
110
|
-
it('Comments', function () {
|
|
111
|
-
isValid('/*d*/ { } /*e*/');
|
|
112
|
-
isInvalid('/*d { }');
|
|
113
|
-
});
|
|
114
|
-
it('Simple AST', function () {
|
|
115
|
-
{
|
|
116
|
-
const { jsonDoc } = toDocument('{}');
|
|
117
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
118
|
-
const node = jsonDoc.getNodeFromOffset(1);
|
|
119
|
-
assert.equal(node.type, 'object');
|
|
120
|
-
assert.strictEqual(jsonDoc.getNodeFromOffset(2), undefined);
|
|
121
|
-
}
|
|
122
|
-
{
|
|
123
|
-
const { jsonDoc } = toDocument('[null]');
|
|
124
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
125
|
-
const node = jsonDoc.getNodeFromOffset(2);
|
|
126
|
-
assert.equal(node.type, 'null');
|
|
127
|
-
}
|
|
128
|
-
{
|
|
129
|
-
const { jsonDoc } = toDocument('{"a":true}');
|
|
130
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
131
|
-
let node = jsonDoc.getNodeFromOffset(3);
|
|
132
|
-
assert.equal(node.type, 'string');
|
|
133
|
-
node = jsonDoc.getNodeFromOffset(4);
|
|
134
|
-
assert.equal(node.type, 'property');
|
|
135
|
-
node = jsonDoc.getNodeFromOffset(0);
|
|
136
|
-
assert.equal(node.type, 'object');
|
|
137
|
-
node = jsonDoc.getNodeFromOffset(10);
|
|
138
|
-
assert.equal(node, undefined);
|
|
139
|
-
node = jsonDoc.getNodeFromOffset(5);
|
|
140
|
-
assert.equal(node.type, 'boolean');
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
it('Nested AST', function () {
|
|
144
|
-
const content = '{\n\t"key" : {\n\t"key2": 42\n\t}\n}';
|
|
145
|
-
const { jsonDoc } = toDocument(content);
|
|
146
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
147
|
-
});
|
|
148
|
-
it('Nested AST in Array', function () {
|
|
149
|
-
const { jsonDoc } = toDocument('{"key":[{"key2":42}]}');
|
|
150
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
151
|
-
});
|
|
152
|
-
it('Multiline', function () {
|
|
153
|
-
{
|
|
154
|
-
const content = '{\n\t\n}';
|
|
155
|
-
const { jsonDoc } = toDocument(content);
|
|
156
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
157
|
-
const node = jsonDoc.getNodeFromOffset(content.indexOf('\t') + 1);
|
|
158
|
-
assert.notEqual(node, null);
|
|
159
|
-
}
|
|
160
|
-
{
|
|
161
|
-
const content = '{\n"first":true\n\n}';
|
|
162
|
-
const { jsonDoc } = toDocument(content);
|
|
163
|
-
let node = jsonDoc.getNodeFromOffset(content.length - 2);
|
|
164
|
-
assert.equal(node.type, 'object');
|
|
165
|
-
node = jsonDoc.getNodeFromOffset(content.length - 4);
|
|
166
|
-
assert.equal(node.type, 'boolean');
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
it('Expand errors to entire tokens', function () {
|
|
170
|
-
const content = '{\n"key":32,\nerror\n}';
|
|
171
|
-
const { jsonDoc } = toDocument(content);
|
|
172
|
-
assert.equal(jsonDoc.syntaxErrors.length, 2);
|
|
173
|
-
assert.deepEqual(jsonDoc.syntaxErrors[0].range, toRange(content, content.indexOf('error'), 5));
|
|
174
|
-
});
|
|
175
|
-
it('Errors at the end of the file', function () {
|
|
176
|
-
const content = '{\n"key":32\n ';
|
|
177
|
-
const { jsonDoc } = toDocument(content);
|
|
178
|
-
assert.equal(jsonDoc.syntaxErrors.length, 1);
|
|
179
|
-
assert.deepEqual(jsonDoc.syntaxErrors[0].range, toRange(content, 9, 1));
|
|
180
|
-
});
|
|
181
|
-
it('Getting keys out of an object', function () {
|
|
182
|
-
const content = '{\n"key":32,\n\n"key2":45}';
|
|
183
|
-
const { jsonDoc } = toDocument(content);
|
|
184
|
-
assert.equal(jsonDoc.syntaxErrors.length, 0);
|
|
185
|
-
const node = jsonDoc.getNodeFromOffset(content.indexOf('32,\n') + 4);
|
|
186
|
-
assertObject(node, ['key', 'key2']);
|
|
187
|
-
});
|
|
188
|
-
it('Missing colon', function () {
|
|
189
|
-
const content = '{\n"key":32,\n"key2"\n"key3": 4 }';
|
|
190
|
-
const { jsonDoc } = toDocument(content);
|
|
191
|
-
assert.equal(jsonDoc.syntaxErrors.length, 1);
|
|
192
|
-
assert.equal(jsonDoc.syntaxErrors[0].code, vscode_json_languageservice_1.ErrorCode.ColonExpected);
|
|
193
|
-
const root = jsonDoc.root;
|
|
194
|
-
assertObject(root, ['key', 'key2', 'key3']);
|
|
195
|
-
});
|
|
196
|
-
it('Missing comma', function () {
|
|
197
|
-
const content = '{\n"key":32,\n"key2": 1 \n"key3": 4 }';
|
|
198
|
-
const { jsonDoc } = toDocument(content);
|
|
199
|
-
assert.equal(jsonDoc.syntaxErrors.length, 1);
|
|
200
|
-
assert.equal(jsonDoc.syntaxErrors[0].code, vscode_json_languageservice_1.ErrorCode.CommaExpected);
|
|
201
|
-
assertObject(jsonDoc.root, ['key', 'key2', 'key3']);
|
|
202
|
-
});
|
|
203
|
-
it('Validate types', function () {
|
|
204
|
-
const str = '{"number": 3.4, "integer": 42, "string": "some string", "boolean":true, "null":null, "object":{}, "array":[1, 2]}';
|
|
205
|
-
const { textDoc, jsonDoc } = toDocument(str);
|
|
206
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
207
|
-
let semanticErrors = jsonDoc.validate(textDoc, {
|
|
208
|
-
type: 'object',
|
|
209
|
-
});
|
|
210
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
211
|
-
semanticErrors = jsonDoc.validate(textDoc, {
|
|
212
|
-
type: 'array',
|
|
213
|
-
});
|
|
214
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
215
|
-
semanticErrors = jsonDoc.validate(textDoc, {
|
|
216
|
-
type: 'object',
|
|
217
|
-
properties: {
|
|
218
|
-
number: {
|
|
219
|
-
type: 'number',
|
|
220
|
-
},
|
|
221
|
-
integer: {
|
|
222
|
-
type: 'integer',
|
|
223
|
-
},
|
|
224
|
-
string: {
|
|
225
|
-
type: 'string',
|
|
226
|
-
},
|
|
227
|
-
boolean: {
|
|
228
|
-
type: 'boolean',
|
|
229
|
-
},
|
|
230
|
-
null: {
|
|
231
|
-
type: 'null',
|
|
232
|
-
},
|
|
233
|
-
object: {
|
|
234
|
-
type: 'object',
|
|
235
|
-
},
|
|
236
|
-
array: {
|
|
237
|
-
type: 'array',
|
|
238
|
-
},
|
|
239
|
-
},
|
|
240
|
-
});
|
|
241
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
242
|
-
semanticErrors = jsonDoc.validate(textDoc, {
|
|
243
|
-
type: 'object',
|
|
244
|
-
properties: {
|
|
245
|
-
number: {
|
|
246
|
-
type: 'array',
|
|
247
|
-
},
|
|
248
|
-
integer: {
|
|
249
|
-
type: 'string',
|
|
250
|
-
},
|
|
251
|
-
string: {
|
|
252
|
-
type: 'object',
|
|
253
|
-
},
|
|
254
|
-
boolean: {
|
|
255
|
-
type: 'null',
|
|
256
|
-
},
|
|
257
|
-
null: {
|
|
258
|
-
type: 'integer',
|
|
259
|
-
},
|
|
260
|
-
object: {
|
|
261
|
-
type: 'boolean',
|
|
262
|
-
},
|
|
263
|
-
array: {
|
|
264
|
-
type: 'number',
|
|
265
|
-
},
|
|
266
|
-
},
|
|
267
|
-
});
|
|
268
|
-
assert.strictEqual(semanticErrors.length, 7);
|
|
269
|
-
semanticErrors = jsonDoc.validate(textDoc, {
|
|
270
|
-
type: 'object',
|
|
271
|
-
properties: {
|
|
272
|
-
number: {
|
|
273
|
-
type: 'integer',
|
|
274
|
-
},
|
|
275
|
-
},
|
|
276
|
-
});
|
|
277
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
278
|
-
semanticErrors = jsonDoc.validate(textDoc, {
|
|
279
|
-
type: 'object',
|
|
280
|
-
properties: {
|
|
281
|
-
integer: {
|
|
282
|
-
type: 'number',
|
|
283
|
-
},
|
|
284
|
-
},
|
|
285
|
-
});
|
|
286
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
287
|
-
semanticErrors = jsonDoc.validate(textDoc, {
|
|
288
|
-
type: 'object',
|
|
289
|
-
properties: {
|
|
290
|
-
array: {
|
|
291
|
-
type: 'array',
|
|
292
|
-
items: {
|
|
293
|
-
type: 'integer',
|
|
294
|
-
},
|
|
295
|
-
},
|
|
296
|
-
},
|
|
297
|
-
});
|
|
298
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
299
|
-
semanticErrors = jsonDoc.validate(textDoc, {
|
|
300
|
-
type: 'object',
|
|
301
|
-
properties: {
|
|
302
|
-
array: {
|
|
303
|
-
type: 'array',
|
|
304
|
-
items: {
|
|
305
|
-
type: 'string',
|
|
306
|
-
},
|
|
307
|
-
},
|
|
308
|
-
},
|
|
309
|
-
});
|
|
310
|
-
assert.strictEqual(semanticErrors.length, 2);
|
|
311
|
-
semanticErrors = jsonDoc.validate(textDoc, {
|
|
312
|
-
type: 'object',
|
|
313
|
-
properties: {
|
|
314
|
-
array: false,
|
|
315
|
-
},
|
|
316
|
-
});
|
|
317
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
318
|
-
semanticErrors = jsonDoc.validate(textDoc, {
|
|
319
|
-
type: 'object',
|
|
320
|
-
properties: {
|
|
321
|
-
array: true,
|
|
322
|
-
},
|
|
323
|
-
});
|
|
324
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
325
|
-
});
|
|
326
|
-
it('Required properties', function () {
|
|
327
|
-
const str = '{"integer": 42, "string": "some string", "boolean":true}';
|
|
328
|
-
const { textDoc, jsonDoc } = toDocument(str);
|
|
329
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
330
|
-
let semanticErrors = jsonDoc.validate(textDoc, {
|
|
331
|
-
type: 'object',
|
|
332
|
-
required: ['string'],
|
|
333
|
-
});
|
|
334
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
335
|
-
semanticErrors = jsonDoc.validate(textDoc, {
|
|
336
|
-
type: 'object',
|
|
337
|
-
required: ['notpresent'],
|
|
338
|
-
});
|
|
339
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
340
|
-
});
|
|
341
|
-
it('Arrays', function () {
|
|
342
|
-
const str = '[1, 2, 3]';
|
|
343
|
-
const { textDoc, jsonDoc } = toDocument(str);
|
|
344
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
345
|
-
let semanticErrors = jsonDoc.validate(textDoc, {
|
|
346
|
-
type: 'array',
|
|
347
|
-
items: {
|
|
348
|
-
type: 'number',
|
|
349
|
-
},
|
|
350
|
-
minItems: 1,
|
|
351
|
-
maxItems: 5,
|
|
352
|
-
});
|
|
353
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
354
|
-
semanticErrors = jsonDoc.validate(textDoc, {
|
|
355
|
-
type: 'array',
|
|
356
|
-
items: {
|
|
357
|
-
type: 'number',
|
|
358
|
-
},
|
|
359
|
-
minItems: 10,
|
|
360
|
-
});
|
|
361
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
362
|
-
semanticErrors = jsonDoc.validate(textDoc, {
|
|
363
|
-
type: 'array',
|
|
364
|
-
items: {
|
|
365
|
-
type: 'number',
|
|
366
|
-
},
|
|
367
|
-
maxItems: 2,
|
|
368
|
-
});
|
|
369
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
370
|
-
});
|
|
371
|
-
it('Strings', function () {
|
|
372
|
-
const str = '{"one":"test"}';
|
|
373
|
-
const { textDoc, jsonDoc } = toDocument(str);
|
|
374
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
375
|
-
let semanticErrors = jsonDoc.validate(textDoc, {
|
|
376
|
-
type: 'object',
|
|
377
|
-
properties: {
|
|
378
|
-
one: {
|
|
379
|
-
type: 'string',
|
|
380
|
-
minLength: 1,
|
|
381
|
-
maxLength: 10,
|
|
382
|
-
},
|
|
383
|
-
},
|
|
384
|
-
});
|
|
385
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
386
|
-
semanticErrors = jsonDoc.validate(textDoc, {
|
|
387
|
-
type: 'object',
|
|
388
|
-
properties: {
|
|
389
|
-
one: {
|
|
390
|
-
type: 'string',
|
|
391
|
-
minLength: 10,
|
|
392
|
-
},
|
|
393
|
-
},
|
|
394
|
-
});
|
|
395
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
396
|
-
semanticErrors = jsonDoc.validate(textDoc, {
|
|
397
|
-
type: 'object',
|
|
398
|
-
properties: {
|
|
399
|
-
one: {
|
|
400
|
-
type: 'string',
|
|
401
|
-
maxLength: 3,
|
|
402
|
-
},
|
|
403
|
-
},
|
|
404
|
-
});
|
|
405
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
406
|
-
semanticErrors = jsonDoc.validate(textDoc, {
|
|
407
|
-
type: 'object',
|
|
408
|
-
properties: {
|
|
409
|
-
one: {
|
|
410
|
-
type: 'string',
|
|
411
|
-
pattern: '^test$',
|
|
412
|
-
},
|
|
413
|
-
},
|
|
414
|
-
});
|
|
415
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
416
|
-
semanticErrors = jsonDoc.validate(textDoc, {
|
|
417
|
-
type: 'object',
|
|
418
|
-
properties: {
|
|
419
|
-
one: {
|
|
420
|
-
type: 'string',
|
|
421
|
-
pattern: 'fail',
|
|
422
|
-
},
|
|
423
|
-
},
|
|
424
|
-
});
|
|
425
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
426
|
-
const schemaWithURI = {
|
|
427
|
-
type: 'object',
|
|
428
|
-
properties: {
|
|
429
|
-
one: {
|
|
430
|
-
type: 'string',
|
|
431
|
-
format: 'uri',
|
|
432
|
-
},
|
|
433
|
-
},
|
|
434
|
-
};
|
|
435
|
-
semanticErrors = jsonDoc.validate(textDoc, schemaWithURI);
|
|
436
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
437
|
-
assert.strictEqual(semanticErrors[0].message, 'String is not a URI: URI with a scheme is expected.');
|
|
438
|
-
semanticErrors = validate('{"one":"http://foo/bar"}', schemaWithURI);
|
|
439
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
440
|
-
semanticErrors = validate('{"one":""}', schemaWithURI);
|
|
441
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
442
|
-
assert.strictEqual(semanticErrors[0].message, 'String is not a URI: URI expected.');
|
|
443
|
-
semanticErrors = validate('{"one":"//foo/bar"}', schemaWithURI);
|
|
444
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
445
|
-
assert.strictEqual(semanticErrors[0].message, 'String is not a URI: URI with a scheme is expected.');
|
|
446
|
-
const schemaWithURIReference = {
|
|
447
|
-
type: 'object',
|
|
448
|
-
properties: {
|
|
449
|
-
one: {
|
|
450
|
-
type: 'string',
|
|
451
|
-
format: 'uri-reference',
|
|
452
|
-
},
|
|
453
|
-
},
|
|
454
|
-
};
|
|
455
|
-
semanticErrors = validate('{"one":""}', schemaWithURIReference);
|
|
456
|
-
assert.strictEqual(semanticErrors.length, 1, 'uri-reference');
|
|
457
|
-
assert.strictEqual(semanticErrors[0].message, 'String is not a URI: URI expected.');
|
|
458
|
-
semanticErrors = validate('{"one":"//foo/bar"}', schemaWithURIReference);
|
|
459
|
-
assert.strictEqual(semanticErrors.length, 0, 'uri-reference');
|
|
460
|
-
const schemaWithEMail = {
|
|
461
|
-
type: 'object',
|
|
462
|
-
properties: {
|
|
463
|
-
mail: {
|
|
464
|
-
type: 'string',
|
|
465
|
-
format: 'email',
|
|
466
|
-
},
|
|
467
|
-
},
|
|
468
|
-
};
|
|
469
|
-
semanticErrors = validate('{"mail":"foo@bar.com"}', schemaWithEMail);
|
|
470
|
-
assert.strictEqual(semanticErrors.length, 0, 'email');
|
|
471
|
-
semanticErrors = validate('{"mail":"foo"}', schemaWithEMail);
|
|
472
|
-
assert.strictEqual(semanticErrors.length, 1, 'email');
|
|
473
|
-
assert.strictEqual(semanticErrors[0].message, 'String is not an e-mail address.');
|
|
474
|
-
const schemaWithColor = {
|
|
475
|
-
type: 'object',
|
|
476
|
-
properties: {
|
|
477
|
-
color: {
|
|
478
|
-
type: 'string',
|
|
479
|
-
format: 'color-hex',
|
|
480
|
-
},
|
|
481
|
-
},
|
|
482
|
-
};
|
|
483
|
-
semanticErrors = validate('{"color":"#FF00FF"}', schemaWithColor);
|
|
484
|
-
assert.strictEqual(semanticErrors.length, 0, 'email');
|
|
485
|
-
semanticErrors = validate('{"color":"#FF00F"}', schemaWithColor);
|
|
486
|
-
assert.strictEqual(semanticErrors.length, 1, 'email');
|
|
487
|
-
assert.strictEqual(semanticErrors[0].message, 'Invalid color format. Use #RGB, #RGBA, #RRGGBB or #RRGGBBAA.');
|
|
488
|
-
const schemaWithDateTime = {
|
|
489
|
-
type: 'object',
|
|
490
|
-
properties: {
|
|
491
|
-
'date-time': {
|
|
492
|
-
type: 'string',
|
|
493
|
-
format: 'date-time',
|
|
494
|
-
},
|
|
495
|
-
date: {
|
|
496
|
-
type: 'string',
|
|
497
|
-
format: 'date',
|
|
498
|
-
},
|
|
499
|
-
time: {
|
|
500
|
-
type: 'string',
|
|
501
|
-
format: 'time',
|
|
502
|
-
},
|
|
503
|
-
},
|
|
504
|
-
};
|
|
505
|
-
semanticErrors = validate('{"date-time":"1985-04-12T23:20:50.52Z"}', schemaWithDateTime);
|
|
506
|
-
assert.strictEqual(semanticErrors.length, 0, 'date-time');
|
|
507
|
-
semanticErrors = validate('{"date-time":"1996-12-19T16:39:57-08:00"}', schemaWithDateTime);
|
|
508
|
-
assert.strictEqual(semanticErrors.length, 0, 'date-time');
|
|
509
|
-
semanticErrors = validate('{"date-time":"1990-12-31T23:59:60Z"}', schemaWithDateTime);
|
|
510
|
-
assert.strictEqual(semanticErrors.length, 0, 'date-time');
|
|
511
|
-
semanticErrors = validate('{"date-time":"1937-01-01T12:00:27.87+00:20"}', schemaWithDateTime);
|
|
512
|
-
assert.strictEqual(semanticErrors.length, 0, 'date-time');
|
|
513
|
-
semanticErrors = validate('{"date-time":"198a-04-12T23:20:50.52Z"}', schemaWithDateTime);
|
|
514
|
-
assert.strictEqual(semanticErrors.length, 1, 'date-time');
|
|
515
|
-
assert.strictEqual(semanticErrors[0].message, 'String is not a RFC3339 date-time.');
|
|
516
|
-
semanticErrors = validate('{"date-time":"198a-04-12"}', schemaWithDateTime);
|
|
517
|
-
assert.strictEqual(semanticErrors.length, 1, 'date-time');
|
|
518
|
-
assert.strictEqual(semanticErrors[0].message, 'String is not a RFC3339 date-time.');
|
|
519
|
-
semanticErrors = validate('{"date-time":""}', schemaWithDateTime);
|
|
520
|
-
assert.strictEqual(semanticErrors.length, 1, 'date-time');
|
|
521
|
-
assert.strictEqual(semanticErrors[0].message, 'String is not a RFC3339 date-time.');
|
|
522
|
-
semanticErrors = validate('{"date":"1937-01-01"}', schemaWithDateTime);
|
|
523
|
-
assert.strictEqual(semanticErrors.length, 0, 'date');
|
|
524
|
-
semanticErrors = validate('{"date":"23:20:50.52Z"}', schemaWithDateTime);
|
|
525
|
-
assert.strictEqual(semanticErrors.length, 1, 'date');
|
|
526
|
-
assert.strictEqual(semanticErrors[0].message, 'String is not a RFC3339 date.');
|
|
527
|
-
semanticErrors = validate('{"time":"23:20:50.52Z"}', schemaWithDateTime);
|
|
528
|
-
assert.strictEqual(semanticErrors.length, 0, 'time');
|
|
529
|
-
semanticErrors = validate('{"time":"198a-04-12T23:20:50.52Z"}', schemaWithDateTime);
|
|
530
|
-
assert.strictEqual(semanticErrors.length, 1, 'time');
|
|
531
|
-
assert.strictEqual(semanticErrors[0].message, 'String is not a RFC3339 time.');
|
|
532
|
-
});
|
|
533
|
-
it('Numbers', function () {
|
|
534
|
-
const str = '{"one": 13.45e+1}';
|
|
535
|
-
const { textDoc, jsonDoc } = toDocument(str);
|
|
536
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
537
|
-
let semanticErrors = jsonDoc.validate(textDoc, {
|
|
538
|
-
type: 'object',
|
|
539
|
-
properties: {
|
|
540
|
-
one: {
|
|
541
|
-
type: 'number',
|
|
542
|
-
minimum: 1,
|
|
543
|
-
maximum: 135,
|
|
544
|
-
},
|
|
545
|
-
},
|
|
546
|
-
});
|
|
547
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
548
|
-
semanticErrors = jsonDoc.validate(textDoc, {
|
|
549
|
-
type: 'object',
|
|
550
|
-
properties: {
|
|
551
|
-
one: {
|
|
552
|
-
type: 'number',
|
|
553
|
-
minimum: 200,
|
|
554
|
-
},
|
|
555
|
-
},
|
|
556
|
-
});
|
|
557
|
-
assert.strictEqual(semanticErrors.length, 1, 'below minimum');
|
|
558
|
-
assert.strictEqual(semanticErrors[0].message, 'Value is below the minimum of 200.');
|
|
559
|
-
semanticErrors = jsonDoc.validate(textDoc, {
|
|
560
|
-
type: 'object',
|
|
561
|
-
properties: {
|
|
562
|
-
one: {
|
|
563
|
-
type: 'number',
|
|
564
|
-
maximum: 130,
|
|
565
|
-
},
|
|
566
|
-
},
|
|
567
|
-
});
|
|
568
|
-
assert.strictEqual(semanticErrors.length, 1, 'above maximum');
|
|
569
|
-
assert.strictEqual(semanticErrors[0].message, 'Value is above the maximum of 130.');
|
|
570
|
-
semanticErrors = jsonDoc.validate(textDoc, {
|
|
571
|
-
type: 'object',
|
|
572
|
-
properties: {
|
|
573
|
-
one: {
|
|
574
|
-
type: 'number',
|
|
575
|
-
minimum: 134.5,
|
|
576
|
-
exclusiveMinimum: true,
|
|
577
|
-
},
|
|
578
|
-
},
|
|
579
|
-
});
|
|
580
|
-
assert.strictEqual(semanticErrors.length, 1, 'at exclusive mininum');
|
|
581
|
-
assert.strictEqual(semanticErrors[0].message, 'Value is below the exclusive minimum of 134.5.');
|
|
582
|
-
semanticErrors = jsonDoc.validate(textDoc, {
|
|
583
|
-
type: 'object',
|
|
584
|
-
properties: {
|
|
585
|
-
one: {
|
|
586
|
-
type: 'number',
|
|
587
|
-
minimum: 134.5,
|
|
588
|
-
exclusiveMinimum: false,
|
|
589
|
-
},
|
|
590
|
-
},
|
|
591
|
-
});
|
|
592
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
593
|
-
semanticErrors = jsonDoc.validate(textDoc, {
|
|
594
|
-
type: 'object',
|
|
595
|
-
properties: {
|
|
596
|
-
one: {
|
|
597
|
-
type: 'number',
|
|
598
|
-
exclusiveMinimum: 134.5,
|
|
599
|
-
},
|
|
600
|
-
},
|
|
601
|
-
});
|
|
602
|
-
assert.strictEqual(semanticErrors.length, 1, 'at exclusive mininum');
|
|
603
|
-
assert.strictEqual(semanticErrors[0].message, 'Value is below the exclusive minimum of 134.5.');
|
|
604
|
-
semanticErrors = jsonDoc.validate(textDoc, {
|
|
605
|
-
type: 'object',
|
|
606
|
-
properties: {
|
|
607
|
-
one: {
|
|
608
|
-
type: 'number',
|
|
609
|
-
maximum: 134.5,
|
|
610
|
-
exclusiveMaximum: true,
|
|
611
|
-
},
|
|
612
|
-
},
|
|
613
|
-
});
|
|
614
|
-
assert.strictEqual(semanticErrors.length, 1, 'at exclusive mininum');
|
|
615
|
-
assert.strictEqual(semanticErrors[0].message, 'Value is above the exclusive maximum of 134.5.');
|
|
616
|
-
semanticErrors = jsonDoc.validate(textDoc, {
|
|
617
|
-
type: 'object',
|
|
618
|
-
properties: {
|
|
619
|
-
one: {
|
|
620
|
-
type: 'number',
|
|
621
|
-
maximum: 134.5,
|
|
622
|
-
exclusiveMaximum: false,
|
|
623
|
-
},
|
|
624
|
-
},
|
|
625
|
-
});
|
|
626
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
627
|
-
semanticErrors = jsonDoc.validate(textDoc, {
|
|
628
|
-
type: 'object',
|
|
629
|
-
properties: {
|
|
630
|
-
one: {
|
|
631
|
-
type: 'number',
|
|
632
|
-
exclusiveMaximum: 134.5,
|
|
633
|
-
},
|
|
634
|
-
},
|
|
635
|
-
});
|
|
636
|
-
assert.strictEqual(semanticErrors.length, 1, 'at exclusive mininum');
|
|
637
|
-
assert.strictEqual(semanticErrors[0].message, 'Value is above the exclusive maximum of 134.5.');
|
|
638
|
-
semanticErrors = jsonDoc.validate(textDoc, {
|
|
639
|
-
type: 'object',
|
|
640
|
-
properties: {
|
|
641
|
-
one: {
|
|
642
|
-
type: 'number',
|
|
643
|
-
minimum: 134.5,
|
|
644
|
-
maximum: 134.5,
|
|
645
|
-
},
|
|
646
|
-
},
|
|
647
|
-
});
|
|
648
|
-
assert.strictEqual(semanticErrors.length, 0, 'equal to min and max');
|
|
649
|
-
});
|
|
650
|
-
it('getNodeFromOffset', function () {
|
|
651
|
-
const content = '{"a": 1,\n\n"d": 2}';
|
|
652
|
-
const { jsonDoc } = toDocument(content);
|
|
653
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
654
|
-
const node = jsonDoc.getNodeFromOffset(content.indexOf(': 2') + 1);
|
|
655
|
-
assert.strictEqual(node.type, 'property');
|
|
656
|
-
});
|
|
657
|
-
it('Duplicate keys', function () {
|
|
658
|
-
{
|
|
659
|
-
const { jsonDoc } = toDocument('{"a": 1, "a": 2}');
|
|
660
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 2, 'Keys should not be the same');
|
|
661
|
-
}
|
|
662
|
-
{
|
|
663
|
-
const { jsonDoc } = toDocument('{"a": { "a": 2, "a": 3}}');
|
|
664
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 2, 'Keys should not be the same');
|
|
665
|
-
}
|
|
666
|
-
{
|
|
667
|
-
const { jsonDoc } = toDocument('[{ "a": 2, "a": 3, "a": 7}]');
|
|
668
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 3, 'Keys should not be the same');
|
|
669
|
-
}
|
|
670
|
-
});
|
|
671
|
-
it('allOf', function () {
|
|
672
|
-
const schema = {
|
|
673
|
-
id: 'test://schemas/main',
|
|
674
|
-
allOf: [
|
|
675
|
-
{
|
|
676
|
-
type: 'object',
|
|
677
|
-
},
|
|
678
|
-
{
|
|
679
|
-
properties: {
|
|
680
|
-
prop1: {
|
|
681
|
-
type: 'number',
|
|
682
|
-
},
|
|
683
|
-
},
|
|
684
|
-
},
|
|
685
|
-
{
|
|
686
|
-
properties: {
|
|
687
|
-
prop2: {
|
|
688
|
-
type: 'boolean',
|
|
689
|
-
},
|
|
690
|
-
},
|
|
691
|
-
},
|
|
692
|
-
],
|
|
693
|
-
};
|
|
694
|
-
{
|
|
695
|
-
const { textDoc, jsonDoc } = toDocument('{"prop1": 42, "prop2": true}');
|
|
696
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
697
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
698
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
699
|
-
}
|
|
700
|
-
{
|
|
701
|
-
const { textDoc, jsonDoc } = toDocument('{"prop1": 42, "prop2": 123}');
|
|
702
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
703
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
704
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
705
|
-
}
|
|
706
|
-
});
|
|
707
|
-
it('anyOf', function () {
|
|
708
|
-
const schema = {
|
|
709
|
-
id: 'test://schemas/main',
|
|
710
|
-
anyOf: [
|
|
711
|
-
{
|
|
712
|
-
properties: {
|
|
713
|
-
prop1: {
|
|
714
|
-
type: 'number',
|
|
715
|
-
},
|
|
716
|
-
},
|
|
717
|
-
},
|
|
718
|
-
{
|
|
719
|
-
properties: {
|
|
720
|
-
prop2: {
|
|
721
|
-
type: 'boolean',
|
|
722
|
-
},
|
|
723
|
-
},
|
|
724
|
-
},
|
|
725
|
-
],
|
|
726
|
-
};
|
|
727
|
-
{
|
|
728
|
-
const str = '{"prop1": 42, "prop2": true}';
|
|
729
|
-
const { textDoc, jsonDoc } = toDocument(str);
|
|
730
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
731
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
732
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
733
|
-
}
|
|
734
|
-
{
|
|
735
|
-
const { textDoc, jsonDoc } = toDocument('{"prop1": 42, "prop2": 123}');
|
|
736
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
737
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
738
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
739
|
-
}
|
|
740
|
-
{
|
|
741
|
-
const { textDoc, jsonDoc } = toDocument('{"prop1": "a string", "prop2": 123}');
|
|
742
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
743
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
744
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
745
|
-
}
|
|
746
|
-
});
|
|
747
|
-
it('oneOf', function () {
|
|
748
|
-
const schema = {
|
|
749
|
-
id: 'test://schemas/main',
|
|
750
|
-
oneOf: [
|
|
751
|
-
{
|
|
752
|
-
properties: {
|
|
753
|
-
prop1: {
|
|
754
|
-
type: 'number',
|
|
755
|
-
},
|
|
756
|
-
},
|
|
757
|
-
},
|
|
758
|
-
{
|
|
759
|
-
properties: {
|
|
760
|
-
prop2: {
|
|
761
|
-
type: 'boolean',
|
|
762
|
-
},
|
|
763
|
-
},
|
|
764
|
-
},
|
|
765
|
-
],
|
|
766
|
-
};
|
|
767
|
-
{
|
|
768
|
-
const { textDoc, jsonDoc } = toDocument('{"prop1": 42, "prop2": true}');
|
|
769
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
770
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
771
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
772
|
-
}
|
|
773
|
-
{
|
|
774
|
-
const { textDoc, jsonDoc } = toDocument('{"prop1": 42, "prop2": 123}');
|
|
775
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
776
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
777
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
778
|
-
}
|
|
779
|
-
{
|
|
780
|
-
const { textDoc, jsonDoc } = toDocument('{"prop1": "a string", "prop2": 123}');
|
|
781
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
782
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
783
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
784
|
-
}
|
|
785
|
-
});
|
|
786
|
-
it('not', function () {
|
|
787
|
-
const schema = {
|
|
788
|
-
id: 'test://schemas/main',
|
|
789
|
-
not: {
|
|
790
|
-
properties: {
|
|
791
|
-
prop1: {
|
|
792
|
-
type: 'number',
|
|
793
|
-
},
|
|
794
|
-
},
|
|
795
|
-
},
|
|
796
|
-
};
|
|
797
|
-
{
|
|
798
|
-
const { textDoc, jsonDoc } = toDocument('{"prop1": 42, "prop2": true}');
|
|
799
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
800
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
801
|
-
}
|
|
802
|
-
{
|
|
803
|
-
const { textDoc, jsonDoc } = toDocument('{"prop1": "test"}');
|
|
804
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
805
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
806
|
-
}
|
|
807
|
-
});
|
|
808
|
-
it('if/then/else', function () {
|
|
809
|
-
const schema = {
|
|
810
|
-
id: 'test://schemas/main',
|
|
811
|
-
if: {
|
|
812
|
-
properties: {
|
|
813
|
-
foo: {
|
|
814
|
-
const: 'bar',
|
|
815
|
-
},
|
|
816
|
-
},
|
|
817
|
-
},
|
|
818
|
-
then: {
|
|
819
|
-
properties: {
|
|
820
|
-
abc: {
|
|
821
|
-
type: 'boolean',
|
|
822
|
-
},
|
|
823
|
-
},
|
|
824
|
-
},
|
|
825
|
-
else: {
|
|
826
|
-
properties: {
|
|
827
|
-
abc: {
|
|
828
|
-
type: 'string',
|
|
829
|
-
},
|
|
830
|
-
},
|
|
831
|
-
},
|
|
832
|
-
};
|
|
833
|
-
{
|
|
834
|
-
const { textDoc, jsonDoc } = toDocument('{"foo": "bar", "abc": true}');
|
|
835
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
836
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
837
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
838
|
-
}
|
|
839
|
-
{
|
|
840
|
-
const { textDoc, jsonDoc } = toDocument('{"foo": "bar", "abc": "baz"}');
|
|
841
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
842
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
843
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
844
|
-
}
|
|
845
|
-
{
|
|
846
|
-
const { textDoc, jsonDoc } = toDocument('{"foo": "test", "abc": true}');
|
|
847
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
848
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
849
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
850
|
-
}
|
|
851
|
-
{
|
|
852
|
-
const { textDoc, jsonDoc } = toDocument('{"foo": "test", "abc": "baz"}');
|
|
853
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
854
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
855
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
856
|
-
}
|
|
857
|
-
});
|
|
858
|
-
it('nested if/then/else', function () {
|
|
859
|
-
const schema = {
|
|
860
|
-
id: 'test://schemas/main',
|
|
861
|
-
if: {
|
|
862
|
-
properties: {
|
|
863
|
-
foo: {
|
|
864
|
-
const: 'bar',
|
|
865
|
-
},
|
|
866
|
-
},
|
|
867
|
-
},
|
|
868
|
-
then: {
|
|
869
|
-
properties: {
|
|
870
|
-
abc: {
|
|
871
|
-
type: 'boolean',
|
|
872
|
-
},
|
|
873
|
-
},
|
|
874
|
-
},
|
|
875
|
-
else: {
|
|
876
|
-
if: {
|
|
877
|
-
properties: {
|
|
878
|
-
foo: {
|
|
879
|
-
const: 'baz',
|
|
880
|
-
},
|
|
881
|
-
},
|
|
882
|
-
},
|
|
883
|
-
then: {
|
|
884
|
-
properties: {
|
|
885
|
-
abc: {
|
|
886
|
-
type: 'array',
|
|
887
|
-
},
|
|
888
|
-
},
|
|
889
|
-
},
|
|
890
|
-
else: {
|
|
891
|
-
properties: {
|
|
892
|
-
abc: {
|
|
893
|
-
type: 'string',
|
|
894
|
-
},
|
|
895
|
-
},
|
|
896
|
-
},
|
|
897
|
-
},
|
|
898
|
-
};
|
|
899
|
-
{
|
|
900
|
-
const { textDoc, jsonDoc } = toDocument('{"foo": "bar", "abc": true}');
|
|
901
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
902
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
903
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
904
|
-
}
|
|
905
|
-
{
|
|
906
|
-
const { textDoc, jsonDoc } = toDocument('{"foo": "bar", "abc": "baz"}');
|
|
907
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
908
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
909
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
910
|
-
}
|
|
911
|
-
{
|
|
912
|
-
const { textDoc, jsonDoc } = toDocument('{"foo": "baz", "abc": []}');
|
|
913
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
914
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
915
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
916
|
-
}
|
|
917
|
-
{
|
|
918
|
-
const { textDoc, jsonDoc } = toDocument('{"foo": "baz", "abc": "baz"}');
|
|
919
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
920
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
921
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
922
|
-
}
|
|
923
|
-
{
|
|
924
|
-
const { textDoc, jsonDoc } = toDocument('{"foo": "test", "abc": true}');
|
|
925
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
926
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
927
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
928
|
-
}
|
|
929
|
-
{
|
|
930
|
-
const { textDoc, jsonDoc } = toDocument('{"foo": "test", "abc": "baz"}');
|
|
931
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
932
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
933
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
934
|
-
}
|
|
935
|
-
});
|
|
936
|
-
it('minProperties', function () {
|
|
937
|
-
const { textDoc, jsonDoc } = toDocument('{"prop1": 42, "prop2": true}');
|
|
938
|
-
const schema = {
|
|
939
|
-
minProperties: 2,
|
|
940
|
-
};
|
|
941
|
-
let semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
942
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
943
|
-
schema.minProperties = 1;
|
|
944
|
-
semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
945
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
946
|
-
schema.minProperties = 3;
|
|
947
|
-
semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
948
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
949
|
-
});
|
|
950
|
-
it('maxProperties', function () {
|
|
951
|
-
const { textDoc, jsonDoc } = toDocument('{"prop1": 42, "prop2": true}');
|
|
952
|
-
const schema = {
|
|
953
|
-
maxProperties: 2,
|
|
954
|
-
};
|
|
955
|
-
let semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
956
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
957
|
-
schema.maxProperties = 3;
|
|
958
|
-
semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
959
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
960
|
-
schema.maxProperties = 1;
|
|
961
|
-
semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
962
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
963
|
-
});
|
|
964
|
-
it('patternProperties', function () {
|
|
965
|
-
let schema = {
|
|
966
|
-
id: 'test://schemas/main',
|
|
967
|
-
patternProperties: {
|
|
968
|
-
'^prop\\d$': {
|
|
969
|
-
type: 'number',
|
|
970
|
-
},
|
|
971
|
-
},
|
|
972
|
-
};
|
|
973
|
-
{
|
|
974
|
-
const { textDoc, jsonDoc } = toDocument('{"prop1": 42, "prop2": 42}');
|
|
975
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
976
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
977
|
-
}
|
|
978
|
-
{
|
|
979
|
-
const { textDoc, jsonDoc } = toDocument('{"prop1": 42, "prop2": true}');
|
|
980
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
981
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
982
|
-
}
|
|
983
|
-
{
|
|
984
|
-
const { textDoc, jsonDoc } = toDocument('{"prop1": 42, "prop2": 123, "aprop3": true}');
|
|
985
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
986
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
987
|
-
}
|
|
988
|
-
schema = {
|
|
989
|
-
id: 'test://schemas/main',
|
|
990
|
-
patternProperties: {
|
|
991
|
-
'^prop\\d$': true,
|
|
992
|
-
'^invalid$': false,
|
|
993
|
-
},
|
|
994
|
-
};
|
|
995
|
-
{
|
|
996
|
-
const { textDoc, jsonDoc } = toDocument('{"prop1": 42 }');
|
|
997
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
998
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
999
|
-
}
|
|
1000
|
-
{
|
|
1001
|
-
const { textDoc, jsonDoc } = toDocument('{"invalid": 42 }');
|
|
1002
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1003
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
1004
|
-
}
|
|
1005
|
-
});
|
|
1006
|
-
it('additionalProperties', function () {
|
|
1007
|
-
let schema = {
|
|
1008
|
-
additionalProperties: {
|
|
1009
|
-
type: 'number',
|
|
1010
|
-
},
|
|
1011
|
-
};
|
|
1012
|
-
{
|
|
1013
|
-
const { textDoc, jsonDoc } = toDocument('{"prop1": 42, "prop2": 42}');
|
|
1014
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1015
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
1016
|
-
}
|
|
1017
|
-
{
|
|
1018
|
-
const { textDoc, jsonDoc } = toDocument('{"prop1": 42, "prop2": true}');
|
|
1019
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1020
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
1021
|
-
}
|
|
1022
|
-
schema = {
|
|
1023
|
-
properties: {
|
|
1024
|
-
prop1: {
|
|
1025
|
-
type: 'boolean',
|
|
1026
|
-
},
|
|
1027
|
-
},
|
|
1028
|
-
additionalProperties: {
|
|
1029
|
-
type: 'number',
|
|
1030
|
-
},
|
|
1031
|
-
};
|
|
1032
|
-
{
|
|
1033
|
-
const { textDoc, jsonDoc } = toDocument('{"prop1": true, "prop2": 42}');
|
|
1034
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1035
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
1036
|
-
}
|
|
1037
|
-
schema = {
|
|
1038
|
-
properties: {
|
|
1039
|
-
prop1: {
|
|
1040
|
-
type: 'boolean',
|
|
1041
|
-
},
|
|
1042
|
-
},
|
|
1043
|
-
additionalProperties: false,
|
|
1044
|
-
};
|
|
1045
|
-
{
|
|
1046
|
-
const { textDoc, jsonDoc } = toDocument('{"prop1": true, "prop2": 42}');
|
|
1047
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1048
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
1049
|
-
}
|
|
1050
|
-
{
|
|
1051
|
-
const { textDoc, jsonDoc } = toDocument('{"prop1": true}');
|
|
1052
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1053
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
1054
|
-
}
|
|
1055
|
-
});
|
|
1056
|
-
it('enum', function () {
|
|
1057
|
-
let schema = {
|
|
1058
|
-
properties: {
|
|
1059
|
-
prop: {
|
|
1060
|
-
enum: ['violin', 'harmonica', 'banjo'],
|
|
1061
|
-
},
|
|
1062
|
-
},
|
|
1063
|
-
};
|
|
1064
|
-
{
|
|
1065
|
-
const { textDoc, jsonDoc } = toDocument('{"prop": "harmonica"}');
|
|
1066
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1067
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
1068
|
-
}
|
|
1069
|
-
{
|
|
1070
|
-
const { textDoc, jsonDoc } = toDocument('{"prop": "harp"}');
|
|
1071
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1072
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
1073
|
-
}
|
|
1074
|
-
schema = {
|
|
1075
|
-
properties: {
|
|
1076
|
-
prop: {
|
|
1077
|
-
enum: [1, 42, 999],
|
|
1078
|
-
},
|
|
1079
|
-
},
|
|
1080
|
-
};
|
|
1081
|
-
{
|
|
1082
|
-
const { textDoc, jsonDoc } = toDocument('{"prop": 42}');
|
|
1083
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1084
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
1085
|
-
}
|
|
1086
|
-
{
|
|
1087
|
-
const { textDoc, jsonDoc } = toDocument('{"prop": 1337}');
|
|
1088
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1089
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
1090
|
-
}
|
|
1091
|
-
schema = {
|
|
1092
|
-
properties: {
|
|
1093
|
-
prop: {
|
|
1094
|
-
enum: ['violin', { name: 'David' }, null],
|
|
1095
|
-
},
|
|
1096
|
-
},
|
|
1097
|
-
};
|
|
1098
|
-
{
|
|
1099
|
-
const { textDoc, jsonDoc } = toDocument('{"prop": { "name": "David" }}');
|
|
1100
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1101
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
1102
|
-
}
|
|
1103
|
-
});
|
|
1104
|
-
it('const', function () {
|
|
1105
|
-
const schema = {
|
|
1106
|
-
properties: {
|
|
1107
|
-
prop: {
|
|
1108
|
-
const: 'violin',
|
|
1109
|
-
},
|
|
1110
|
-
},
|
|
1111
|
-
};
|
|
1112
|
-
{
|
|
1113
|
-
const { textDoc, jsonDoc } = toDocument('{"prop": "violin"}');
|
|
1114
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1115
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
1116
|
-
}
|
|
1117
|
-
{
|
|
1118
|
-
const { textDoc, jsonDoc } = toDocument('{"prop": "harmonica"}');
|
|
1119
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1120
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
1121
|
-
assert.strictEqual(semanticErrors[0].code, vscode_json_languageservice_1.ErrorCode.EnumValueMismatch);
|
|
1122
|
-
}
|
|
1123
|
-
{
|
|
1124
|
-
const schema = {
|
|
1125
|
-
properties: {
|
|
1126
|
-
prop: {
|
|
1127
|
-
const: { foo: 2 },
|
|
1128
|
-
},
|
|
1129
|
-
},
|
|
1130
|
-
};
|
|
1131
|
-
const { textDoc, jsonDoc } = toDocument('{"prop": { "foo": 2 }');
|
|
1132
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1133
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
1134
|
-
}
|
|
1135
|
-
});
|
|
1136
|
-
it('oneOf const', function () {
|
|
1137
|
-
const schema = {
|
|
1138
|
-
properties: {
|
|
1139
|
-
prop: {
|
|
1140
|
-
oneOf: [
|
|
1141
|
-
{
|
|
1142
|
-
const: 0,
|
|
1143
|
-
title: 'Value of 0',
|
|
1144
|
-
},
|
|
1145
|
-
{
|
|
1146
|
-
const: 1,
|
|
1147
|
-
title: 'Value of 1',
|
|
1148
|
-
},
|
|
1149
|
-
{
|
|
1150
|
-
const: 2,
|
|
1151
|
-
title: 'Value of 2',
|
|
1152
|
-
},
|
|
1153
|
-
],
|
|
1154
|
-
},
|
|
1155
|
-
},
|
|
1156
|
-
};
|
|
1157
|
-
{
|
|
1158
|
-
const { textDoc, jsonDoc } = toDocument('{"prop": 0}');
|
|
1159
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1160
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
1161
|
-
}
|
|
1162
|
-
{
|
|
1163
|
-
const { textDoc, jsonDoc } = toDocument('{"prop": 4}');
|
|
1164
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1165
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
1166
|
-
assert.strictEqual(semanticErrors[0].code, vscode_json_languageservice_1.ErrorCode.EnumValueMismatch);
|
|
1167
|
-
}
|
|
1168
|
-
});
|
|
1169
|
-
it('propertyNames', function () {
|
|
1170
|
-
const schema = {
|
|
1171
|
-
propertyNames: {
|
|
1172
|
-
type: 'string',
|
|
1173
|
-
minLength: 2,
|
|
1174
|
-
maxLength: 6,
|
|
1175
|
-
},
|
|
1176
|
-
};
|
|
1177
|
-
{
|
|
1178
|
-
const { textDoc, jsonDoc } = toDocument('{"violin": true}');
|
|
1179
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1180
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
1181
|
-
}
|
|
1182
|
-
{
|
|
1183
|
-
const { textDoc, jsonDoc } = toDocument('{"harmonica": false, "violin": true}');
|
|
1184
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1185
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
1186
|
-
assert.strictEqual(semanticErrors[0].message, 'String is longer than the maximum length of 6.');
|
|
1187
|
-
}
|
|
1188
|
-
});
|
|
1189
|
-
it('uniqueItems', function () {
|
|
1190
|
-
const { textDoc, jsonDoc } = toDocument('[1, 2, 3]');
|
|
1191
|
-
const schema = {
|
|
1192
|
-
type: 'array',
|
|
1193
|
-
uniqueItems: true,
|
|
1194
|
-
};
|
|
1195
|
-
{
|
|
1196
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1197
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
1198
|
-
}
|
|
1199
|
-
{
|
|
1200
|
-
const { textDoc, jsonDoc } = toDocument('[1, 2, 3, 2]');
|
|
1201
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1202
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
1203
|
-
}
|
|
1204
|
-
{
|
|
1205
|
-
const { textDoc, jsonDoc } = toDocument('[1, 2, "string", 52, "string"]');
|
|
1206
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1207
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
1208
|
-
}
|
|
1209
|
-
});
|
|
1210
|
-
it('containsItem', function () {
|
|
1211
|
-
const schema = {
|
|
1212
|
-
type: 'array',
|
|
1213
|
-
contains: { type: 'number', const: 3 },
|
|
1214
|
-
};
|
|
1215
|
-
{
|
|
1216
|
-
const { textDoc, jsonDoc } = toDocument('[1, 2, 3]');
|
|
1217
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1218
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
1219
|
-
}
|
|
1220
|
-
{
|
|
1221
|
-
const { textDoc, jsonDoc } = toDocument('[1, 2, 5]');
|
|
1222
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1223
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
1224
|
-
}
|
|
1225
|
-
});
|
|
1226
|
-
it('items as array', function () {
|
|
1227
|
-
const schema = {
|
|
1228
|
-
type: 'array',
|
|
1229
|
-
items: [
|
|
1230
|
-
{
|
|
1231
|
-
type: 'integer',
|
|
1232
|
-
},
|
|
1233
|
-
{
|
|
1234
|
-
type: 'boolean',
|
|
1235
|
-
},
|
|
1236
|
-
{
|
|
1237
|
-
type: 'string',
|
|
1238
|
-
},
|
|
1239
|
-
],
|
|
1240
|
-
};
|
|
1241
|
-
{
|
|
1242
|
-
const { textDoc, jsonDoc } = toDocument('[1, true, "string"]');
|
|
1243
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1244
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
1245
|
-
}
|
|
1246
|
-
{
|
|
1247
|
-
const { textDoc, jsonDoc } = toDocument('["string", 1, true]');
|
|
1248
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1249
|
-
assert.strictEqual(semanticErrors.length, 3);
|
|
1250
|
-
}
|
|
1251
|
-
{
|
|
1252
|
-
const { textDoc, jsonDoc } = toDocument('[1, true, "string", "another", 42]');
|
|
1253
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1254
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
1255
|
-
}
|
|
1256
|
-
});
|
|
1257
|
-
it('additionalItems', function () {
|
|
1258
|
-
let schema = {
|
|
1259
|
-
type: 'array',
|
|
1260
|
-
items: [
|
|
1261
|
-
{
|
|
1262
|
-
type: 'integer',
|
|
1263
|
-
},
|
|
1264
|
-
{
|
|
1265
|
-
type: 'boolean',
|
|
1266
|
-
},
|
|
1267
|
-
{
|
|
1268
|
-
type: 'string',
|
|
1269
|
-
},
|
|
1270
|
-
],
|
|
1271
|
-
additionalItems: false,
|
|
1272
|
-
};
|
|
1273
|
-
{
|
|
1274
|
-
const { textDoc, jsonDoc } = toDocument('[1, true, "string"]');
|
|
1275
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1276
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
1277
|
-
}
|
|
1278
|
-
{
|
|
1279
|
-
const { textDoc, jsonDoc } = toDocument('[1, true, "string", 42]');
|
|
1280
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1281
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
1282
|
-
}
|
|
1283
|
-
schema = {
|
|
1284
|
-
type: 'array',
|
|
1285
|
-
items: [
|
|
1286
|
-
{
|
|
1287
|
-
type: 'integer',
|
|
1288
|
-
},
|
|
1289
|
-
{
|
|
1290
|
-
type: 'boolean',
|
|
1291
|
-
},
|
|
1292
|
-
{
|
|
1293
|
-
type: 'string',
|
|
1294
|
-
},
|
|
1295
|
-
],
|
|
1296
|
-
additionalItems: {
|
|
1297
|
-
type: 'boolean',
|
|
1298
|
-
},
|
|
1299
|
-
};
|
|
1300
|
-
{
|
|
1301
|
-
const { textDoc, jsonDoc } = toDocument('[1, true, "string"]');
|
|
1302
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1303
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
1304
|
-
}
|
|
1305
|
-
{
|
|
1306
|
-
const { textDoc, jsonDoc } = toDocument('[1, true, "string", false, true]');
|
|
1307
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1308
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
1309
|
-
}
|
|
1310
|
-
{
|
|
1311
|
-
const { textDoc, jsonDoc } = toDocument('[1, true, "string", true, "Hello"]');
|
|
1312
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1313
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
1314
|
-
}
|
|
1315
|
-
});
|
|
1316
|
-
it('multipleOf', function () {
|
|
1317
|
-
const schema = {
|
|
1318
|
-
type: 'array',
|
|
1319
|
-
items: {
|
|
1320
|
-
type: 'integer',
|
|
1321
|
-
multipleOf: 2,
|
|
1322
|
-
},
|
|
1323
|
-
};
|
|
1324
|
-
{
|
|
1325
|
-
const { textDoc, jsonDoc } = toDocument('[42]');
|
|
1326
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1327
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
1328
|
-
}
|
|
1329
|
-
{
|
|
1330
|
-
const { textDoc, jsonDoc } = toDocument('[43]');
|
|
1331
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1332
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
1333
|
-
}
|
|
1334
|
-
});
|
|
1335
|
-
it('multipleOfFloat', function () {
|
|
1336
|
-
const schema = {
|
|
1337
|
-
type: 'array',
|
|
1338
|
-
items: {
|
|
1339
|
-
type: 'number',
|
|
1340
|
-
multipleOf: 0.05,
|
|
1341
|
-
},
|
|
1342
|
-
};
|
|
1343
|
-
{
|
|
1344
|
-
const { textDoc, jsonDoc } = toDocument('[0.9]');
|
|
1345
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1346
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
1347
|
-
}
|
|
1348
|
-
{
|
|
1349
|
-
const { textDoc, jsonDoc } = toDocument('[42.3222222]');
|
|
1350
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1351
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
1352
|
-
}
|
|
1353
|
-
});
|
|
1354
|
-
it('dependencies with array', function () {
|
|
1355
|
-
const schema = {
|
|
1356
|
-
type: 'object',
|
|
1357
|
-
properties: {
|
|
1358
|
-
a: {
|
|
1359
|
-
type: 'boolean',
|
|
1360
|
-
},
|
|
1361
|
-
},
|
|
1362
|
-
dependencies: {
|
|
1363
|
-
a: ['b'],
|
|
1364
|
-
},
|
|
1365
|
-
};
|
|
1366
|
-
{
|
|
1367
|
-
const { textDoc, jsonDoc } = toDocument('{"a":true, "b":42}');
|
|
1368
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1369
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
1370
|
-
}
|
|
1371
|
-
{
|
|
1372
|
-
const { textDoc, jsonDoc } = toDocument('{}');
|
|
1373
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1374
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
1375
|
-
}
|
|
1376
|
-
{
|
|
1377
|
-
const { textDoc, jsonDoc } = toDocument('{"a":true}');
|
|
1378
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1379
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
1380
|
-
}
|
|
1381
|
-
});
|
|
1382
|
-
it('dependencies with schema', function () {
|
|
1383
|
-
const schema = {
|
|
1384
|
-
type: 'object',
|
|
1385
|
-
properties: {
|
|
1386
|
-
a: {
|
|
1387
|
-
type: 'boolean',
|
|
1388
|
-
},
|
|
1389
|
-
},
|
|
1390
|
-
dependencies: {
|
|
1391
|
-
a: {
|
|
1392
|
-
properties: {
|
|
1393
|
-
b: {
|
|
1394
|
-
type: 'integer',
|
|
1395
|
-
},
|
|
1396
|
-
},
|
|
1397
|
-
},
|
|
1398
|
-
},
|
|
1399
|
-
};
|
|
1400
|
-
{
|
|
1401
|
-
const { textDoc, jsonDoc } = toDocument('{"a":true, "b":42}');
|
|
1402
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1403
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
1404
|
-
}
|
|
1405
|
-
{
|
|
1406
|
-
const { textDoc, jsonDoc } = toDocument('{}');
|
|
1407
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1408
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
1409
|
-
}
|
|
1410
|
-
{
|
|
1411
|
-
const { textDoc, jsonDoc } = toDocument('{"a":true}');
|
|
1412
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1413
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
1414
|
-
}
|
|
1415
|
-
{
|
|
1416
|
-
const { textDoc, jsonDoc } = toDocument('{"a":true, "b": "string"}');
|
|
1417
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1418
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
1419
|
-
}
|
|
1420
|
-
});
|
|
1421
|
-
it('type as array', function () {
|
|
1422
|
-
const schema = {
|
|
1423
|
-
type: 'object',
|
|
1424
|
-
properties: {
|
|
1425
|
-
prop: {
|
|
1426
|
-
type: ['number', 'string'],
|
|
1427
|
-
},
|
|
1428
|
-
},
|
|
1429
|
-
};
|
|
1430
|
-
{
|
|
1431
|
-
const { textDoc, jsonDoc } = toDocument('{"prop": 42}');
|
|
1432
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1433
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
1434
|
-
}
|
|
1435
|
-
{
|
|
1436
|
-
const { textDoc, jsonDoc } = toDocument('{"prop": "string"}');
|
|
1437
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1438
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
1439
|
-
}
|
|
1440
|
-
{
|
|
1441
|
-
const { textDoc, jsonDoc } = toDocument('{"prop": true}');
|
|
1442
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1443
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
1444
|
-
}
|
|
1445
|
-
});
|
|
1446
|
-
it('deprecated', function () {
|
|
1447
|
-
const { textDoc, jsonDoc } = toDocument('{"prop": 42}');
|
|
1448
|
-
const schema = {
|
|
1449
|
-
type: 'object',
|
|
1450
|
-
properties: {
|
|
1451
|
-
prop: {
|
|
1452
|
-
deprecationMessage: 'Prop is deprecated',
|
|
1453
|
-
},
|
|
1454
|
-
},
|
|
1455
|
-
};
|
|
1456
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1457
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
1458
|
-
});
|
|
1459
|
-
it('Strings with spaces', function () {
|
|
1460
|
-
const { jsonDoc } = toDocument('{"key1":"first string", "key2":["second string"]}');
|
|
1461
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
1462
|
-
let node = jsonDoc.getNodeFromOffset(9);
|
|
1463
|
-
assert.strictEqual((0, astNodeUtils_1.getNodeValue)(node), 'first string');
|
|
1464
|
-
node = jsonDoc.getNodeFromOffset(34);
|
|
1465
|
-
assert.strictEqual((0, astNodeUtils_1.getNodeValue)(node), 'second string');
|
|
1466
|
-
});
|
|
1467
|
-
it('Schema information on node', function () {
|
|
1468
|
-
const { jsonDoc } = toDocument('{"key":42}');
|
|
1469
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
1470
|
-
const schema = {
|
|
1471
|
-
type: 'object',
|
|
1472
|
-
properties: {
|
|
1473
|
-
key: {
|
|
1474
|
-
oneOf: [
|
|
1475
|
-
{
|
|
1476
|
-
type: 'number',
|
|
1477
|
-
description: 'this is a number',
|
|
1478
|
-
},
|
|
1479
|
-
{
|
|
1480
|
-
type: 'string',
|
|
1481
|
-
description: 'this is a string',
|
|
1482
|
-
},
|
|
1483
|
-
],
|
|
1484
|
-
},
|
|
1485
|
-
},
|
|
1486
|
-
};
|
|
1487
|
-
const node = jsonDoc.getNodeFromOffset(7);
|
|
1488
|
-
assert.strictEqual(node.type, 'number');
|
|
1489
|
-
assert.strictEqual((0, astNodeUtils_1.getNodeValue)(node), 42);
|
|
1490
|
-
const matchingSchemas = jsonDoc.getMatchingSchemas(schema);
|
|
1491
|
-
const schemas = matchingSchemas.filter((s) => s.node === node && !s.inverted).map((s) => s.schema);
|
|
1492
|
-
assert.ok(Array.isArray(schemas));
|
|
1493
|
-
// 0 is the most specific schema,
|
|
1494
|
-
// 1 is the schema that contained the "oneOf" clause,
|
|
1495
|
-
assert.strictEqual(schemas.length, 2);
|
|
1496
|
-
assert.strictEqual(schemas[0].description, 'this is a number');
|
|
1497
|
-
});
|
|
1498
|
-
it('parse with comments', function () {
|
|
1499
|
-
function parse(v) {
|
|
1500
|
-
const { jsonDoc } = toDocument(v);
|
|
1501
|
-
assert.equal(jsonDoc.syntaxErrors.length, 0);
|
|
1502
|
-
return (0, astNodeUtils_1.getNodeValue)(jsonDoc.root);
|
|
1503
|
-
}
|
|
1504
|
-
let value = parse('// comment\n{\n"far": "boo"\n}');
|
|
1505
|
-
assert.equal(value.far, 'boo');
|
|
1506
|
-
value = parse('/* comm\nent\nent */\n{\n"far": "boo"\n}');
|
|
1507
|
-
assert.equal(value.far, 'boo');
|
|
1508
|
-
value = parse('{\n"far": "boo"\n}');
|
|
1509
|
-
assert.equal(value.far, 'boo');
|
|
1510
|
-
});
|
|
1511
|
-
it('parse with comments collected', function () {
|
|
1512
|
-
function assertParse(v, expectedComments) {
|
|
1513
|
-
const { jsonDoc } = toDocument(v);
|
|
1514
|
-
assert.equal(jsonDoc.comments.length, expectedComments);
|
|
1515
|
-
}
|
|
1516
|
-
assertParse('// comment\n{\n"far": "boo"\n}', 1);
|
|
1517
|
-
assertParse('/* comm\nent\nent */\n{\n"far": "boo"\n}', 1);
|
|
1518
|
-
assertParse('{\n"far": "boo"\n}', 0);
|
|
1519
|
-
});
|
|
1520
|
-
it('validate alternatives', function () {
|
|
1521
|
-
const schema = {
|
|
1522
|
-
type: 'object',
|
|
1523
|
-
properties: {
|
|
1524
|
-
key: {
|
|
1525
|
-
oneOf: [
|
|
1526
|
-
{
|
|
1527
|
-
type: 'object',
|
|
1528
|
-
properties: {
|
|
1529
|
-
type: {
|
|
1530
|
-
enum: ['foo'],
|
|
1531
|
-
},
|
|
1532
|
-
prop1: {
|
|
1533
|
-
type: 'boolean',
|
|
1534
|
-
},
|
|
1535
|
-
prop2: {
|
|
1536
|
-
type: 'boolean',
|
|
1537
|
-
},
|
|
1538
|
-
},
|
|
1539
|
-
},
|
|
1540
|
-
{
|
|
1541
|
-
type: 'object',
|
|
1542
|
-
properties: {
|
|
1543
|
-
type: {
|
|
1544
|
-
enum: ['bar'],
|
|
1545
|
-
},
|
|
1546
|
-
prop2: {
|
|
1547
|
-
type: 'number',
|
|
1548
|
-
},
|
|
1549
|
-
},
|
|
1550
|
-
},
|
|
1551
|
-
],
|
|
1552
|
-
},
|
|
1553
|
-
},
|
|
1554
|
-
};
|
|
1555
|
-
{
|
|
1556
|
-
const { textDoc, jsonDoc } = toDocument('{"key":{"type":"foo", "prop2":1 }}');
|
|
1557
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
1558
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1559
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
1560
|
-
assert.strictEqual(semanticErrors[0].message, 'Incorrect type. Expected "boolean".');
|
|
1561
|
-
}
|
|
1562
|
-
{
|
|
1563
|
-
const { textDoc, jsonDoc } = toDocument('{"key":{"type":"bar", "prop1":true, "prop2":false }}');
|
|
1564
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
1565
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1566
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
1567
|
-
assert.strictEqual(semanticErrors[0].message, 'Incorrect type. Expected "number".');
|
|
1568
|
-
}
|
|
1569
|
-
});
|
|
1570
|
-
it('validate alternatives 2', function () {
|
|
1571
|
-
const schema = {
|
|
1572
|
-
type: 'object',
|
|
1573
|
-
properties: {
|
|
1574
|
-
key: {
|
|
1575
|
-
oneOf: [
|
|
1576
|
-
{
|
|
1577
|
-
type: 'object',
|
|
1578
|
-
properties: {
|
|
1579
|
-
type: {
|
|
1580
|
-
enum: ['foo'],
|
|
1581
|
-
},
|
|
1582
|
-
prop1: {
|
|
1583
|
-
enum: ['v1, v2'],
|
|
1584
|
-
},
|
|
1585
|
-
prop2: {
|
|
1586
|
-
enum: ['w1', 'w2'],
|
|
1587
|
-
},
|
|
1588
|
-
},
|
|
1589
|
-
},
|
|
1590
|
-
{
|
|
1591
|
-
type: 'object',
|
|
1592
|
-
properties: {
|
|
1593
|
-
type: {
|
|
1594
|
-
enum: ['bar'],
|
|
1595
|
-
},
|
|
1596
|
-
prop2: {
|
|
1597
|
-
enum: ['x1', 'x2'],
|
|
1598
|
-
},
|
|
1599
|
-
},
|
|
1600
|
-
},
|
|
1601
|
-
],
|
|
1602
|
-
},
|
|
1603
|
-
},
|
|
1604
|
-
};
|
|
1605
|
-
{
|
|
1606
|
-
const { textDoc, jsonDoc } = toDocument('{"key":{"type":"foo", "prop2":"x1" }}');
|
|
1607
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
1608
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1609
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
1610
|
-
assert.strictEqual(semanticErrors[0].message, 'Value is not accepted. Valid values: "w1", "w2".');
|
|
1611
|
-
}
|
|
1612
|
-
{
|
|
1613
|
-
const { textDoc, jsonDoc } = toDocument('{"key":{"type":"bar", "prop1":"v1", "prop2":"w1" }}');
|
|
1614
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
1615
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1616
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
1617
|
-
assert.strictEqual(semanticErrors[0].message, 'Value is not accepted. Valid values: "x1", "x2".');
|
|
1618
|
-
}
|
|
1619
|
-
});
|
|
1620
|
-
it('enum value merge', function () {
|
|
1621
|
-
const schema = {
|
|
1622
|
-
type: 'object',
|
|
1623
|
-
properties: {
|
|
1624
|
-
key: {
|
|
1625
|
-
oneOf: [
|
|
1626
|
-
{
|
|
1627
|
-
enum: ['a', 'b'],
|
|
1628
|
-
},
|
|
1629
|
-
{
|
|
1630
|
-
enum: ['c', 'd'],
|
|
1631
|
-
},
|
|
1632
|
-
],
|
|
1633
|
-
},
|
|
1634
|
-
},
|
|
1635
|
-
};
|
|
1636
|
-
const { textDoc, jsonDoc } = toDocument('{"key":3 }');
|
|
1637
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
1638
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1639
|
-
assert.strictEqual(semanticErrors.length, 1);
|
|
1640
|
-
assert.strictEqual(semanticErrors[0].message, 'Value is not accepted. Valid values: "a", "b", "c", "d".');
|
|
1641
|
-
});
|
|
1642
|
-
it('value matches more than one schema in oneOf', function () {
|
|
1643
|
-
const schema = {
|
|
1644
|
-
type: 'object',
|
|
1645
|
-
properties: {
|
|
1646
|
-
repository: {
|
|
1647
|
-
oneOf: [
|
|
1648
|
-
{
|
|
1649
|
-
type: 'string',
|
|
1650
|
-
format: 'uri',
|
|
1651
|
-
},
|
|
1652
|
-
{
|
|
1653
|
-
type: 'string',
|
|
1654
|
-
pattern: '^@',
|
|
1655
|
-
},
|
|
1656
|
-
],
|
|
1657
|
-
},
|
|
1658
|
-
},
|
|
1659
|
-
};
|
|
1660
|
-
const { textDoc, jsonDoc } = toDocument('{"repository":"@bitnami"}');
|
|
1661
|
-
assert.strictEqual(jsonDoc.syntaxErrors.length, 0);
|
|
1662
|
-
const semanticErrors = jsonDoc.validate(textDoc, schema);
|
|
1663
|
-
assert.strictEqual(semanticErrors.length, 0);
|
|
1664
|
-
});
|
|
1665
|
-
it('validate API', async function () {
|
|
1666
|
-
const { textDoc, jsonDoc } = toDocument('{ "pages": [ "pages/index", "pages/log", ] }');
|
|
1667
|
-
const ls = (0, vscode_json_languageservice_1.getLanguageService)({});
|
|
1668
|
-
let res = await ls.doValidation(textDoc, jsonDoc);
|
|
1669
|
-
assert.strictEqual(res.length, 1);
|
|
1670
|
-
assert.strictEqual(res[0].message, 'Trailing comma');
|
|
1671
|
-
res = await ls.doValidation(textDoc, jsonDoc, { trailingCommas: 'error' });
|
|
1672
|
-
assert.strictEqual(res.length, 1);
|
|
1673
|
-
assert.strictEqual(res[0].message, 'Trailing comma');
|
|
1674
|
-
res = await ls.doValidation(textDoc, jsonDoc, { trailingCommas: 'ignore' });
|
|
1675
|
-
assert.strictEqual(res.length, 0);
|
|
1676
|
-
const schema = { type: 'object', required: ['foo'] };
|
|
1677
|
-
res = await ls.doValidation(textDoc, jsonDoc, { trailingCommas: 'ignore' }, schema);
|
|
1678
|
-
assert.strictEqual(res.length, 1);
|
|
1679
|
-
assert.strictEqual(res[0].message, 'Missing property "foo".');
|
|
1680
|
-
});
|
|
1681
|
-
});
|
|
1682
|
-
//# sourceMappingURL=jsonParser.test.js.map
|