Complete residential site build with Docker Compose & Gitea Actions deployment
This commit is contained in:
node_modules/yaml-language-server/lib/umd/languageservice/parser/schemaValidation/baseValidator.d.ts
Generated
Vendored
+124
@@ -0,0 +1,124 @@
|
||||
import type { JSONSchema, JSONSchemaRef, SchemaDialect } from '../../jsonSchema';
|
||||
import type { ASTNode, ArrayASTNode, NumberASTNode, ObjectASTNode, StringASTNode } from '../../jsonASTTypes';
|
||||
import { ErrorCode } from 'vscode-json-languageservice';
|
||||
import { Diagnostic, DiagnosticSeverity } from 'vscode-languageserver-types';
|
||||
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
||||
export declare const YAML_SOURCE = "YAML";
|
||||
export interface IRange {
|
||||
offset: number;
|
||||
length: number;
|
||||
}
|
||||
export declare enum ProblemType {
|
||||
missingRequiredPropWarning = "missingRequiredPropWarning",
|
||||
typeMismatchWarning = "typeMismatchWarning",
|
||||
constWarning = "constWarning"
|
||||
}
|
||||
export declare const ProblemTypeMessages: Record<ProblemType, string>;
|
||||
export interface IProblem {
|
||||
location: IRange;
|
||||
severity: DiagnosticSeverity;
|
||||
code?: ErrorCode;
|
||||
message: string;
|
||||
source?: string;
|
||||
problemType?: ProblemType;
|
||||
problemArgs?: string[];
|
||||
schemaUri?: string[];
|
||||
data?: Record<string, unknown>;
|
||||
}
|
||||
export interface IApplicableSchema {
|
||||
node: ASTNode;
|
||||
inverted?: boolean;
|
||||
schema: JSONSchema;
|
||||
}
|
||||
export interface ISchemaCollector {
|
||||
schemas: IApplicableSchema[];
|
||||
add(schema: IApplicableSchema): void;
|
||||
merge(other: ISchemaCollector): void;
|
||||
include(node: ASTNode): boolean;
|
||||
newSub(): ISchemaCollector;
|
||||
}
|
||||
export declare const formats: Record<string, {
|
||||
errorMessage: string;
|
||||
pattern: RegExp;
|
||||
}>;
|
||||
export declare class ValidationResult {
|
||||
problems: IProblem[];
|
||||
propertiesMatches: number;
|
||||
propertiesValueMatches: number;
|
||||
primaryValueMatches: number;
|
||||
enumValueMatch: boolean;
|
||||
enumValues: any[];
|
||||
/**
|
||||
* Optional bookkeeping for newer drafts (2019/2020).
|
||||
* BaseValidator only populates evaluatedProperties conservatively for object keywords it processes directly.
|
||||
*/
|
||||
evaluatedProperties?: Set<string>;
|
||||
evaluatedItemsByNode?: Map<ASTNode, Set<number>>;
|
||||
constructor(isKubernetes: boolean);
|
||||
getEvaluatedItems(node: ASTNode): Set<number>;
|
||||
hasProblems(): boolean;
|
||||
merge(other: ValidationResult): void;
|
||||
mergeEnumValues(other: ValidationResult): void;
|
||||
mergeWarningGeneric(sub: ValidationResult, problemTypesToMerge: ProblemType[]): void;
|
||||
mergePropertyMatch(propertyValidationResult: ValidationResult, mergeEvaluated?: boolean): void;
|
||||
private mergeSources;
|
||||
compareGeneric(other: ValidationResult): number;
|
||||
compareKubernetes(other: ValidationResult): number;
|
||||
}
|
||||
export interface Options {
|
||||
isKubernetes: boolean;
|
||||
disableAdditionalProperties: boolean;
|
||||
uri: string;
|
||||
callFromAutoComplete?: boolean;
|
||||
}
|
||||
interface IValidationMatch {
|
||||
schema: JSONSchema;
|
||||
validationResult: ValidationResult;
|
||||
matchingSchemas: ISchemaCollector;
|
||||
}
|
||||
export declare abstract class BaseValidator {
|
||||
protected collectSeenKeys(node: ObjectASTNode): Record<string, ASTNode>;
|
||||
validateDocument(root: ASTNode, textDocument: TextDocument, schema: JSONSchema, options: Options): Diagnostic[];
|
||||
getMatchingSchemas(root: ASTNode, schema: JSONSchema, options: Options, focusOffset: number, exclude: ASTNode | null): IApplicableSchema[];
|
||||
protected getNoOpCollector(): ISchemaCollector;
|
||||
protected getSchemaSource(schema: JSONSchema, originalSchema: JSONSchema): string;
|
||||
protected getSchemaUri(schema: JSONSchema, originalSchema: JSONSchema): string[];
|
||||
/**
|
||||
* Draft-specific hook: interpret numeric bounds in the draft’s way.
|
||||
* - Draft07+: numeric exclusiveMinimum/exclusiveMaximum
|
||||
* - Draft04: boolean exclusiveMinimum/exclusiveMaximum that modify minimum/maximum
|
||||
*/
|
||||
protected abstract getNumberLimits(schema: JSONSchema): {
|
||||
minimum?: number;
|
||||
maximum?: number;
|
||||
exclusiveMinimum?: number;
|
||||
exclusiveMaximum?: number;
|
||||
};
|
||||
/**
|
||||
* Get the current validator's dialect.
|
||||
*/
|
||||
protected abstract getCurrentDialect(): SchemaDialect;
|
||||
protected validateNode(node: ASTNode, schema: JSONSchema, originalSchema: JSONSchema, validationResult: ValidationResult, matchingSchemas: ISchemaCollector, options: Options): void;
|
||||
protected validateGenericNode(node: ASTNode, schema: JSONSchema, originalSchema: JSONSchema, validationResult: ValidationResult, matchingSchemas: ISchemaCollector, options: Options): void;
|
||||
protected validateStringNode(node: StringASTNode, schema: JSONSchema, originalSchema: JSONSchema, validationResult: ValidationResult): void;
|
||||
protected validateNumberNode(node: NumberASTNode, schema: JSONSchema, originalSchema: JSONSchema, validationResult: ValidationResult): void;
|
||||
protected validateArrayNode(node: ArrayASTNode, schema: JSONSchema, originalSchema: JSONSchema, validationResult: ValidationResult, matchingSchemas: ISchemaCollector, options: Options): void;
|
||||
protected applyContains(node: ArrayASTNode, schema: JSONSchema, originalSchema: JSONSchema, validationResult: ValidationResult, _matchingSchemas: ISchemaCollector, options: Options): void;
|
||||
protected applyArrayLength(node: ArrayASTNode, schema: JSONSchema, originalSchema: JSONSchema, validationResult: ValidationResult, _options: Options): void;
|
||||
protected applyUniqueItems(node: ArrayASTNode, schema: JSONSchema, originalSchema: JSONSchema, validationResult: ValidationResult): void;
|
||||
protected validateObjectNode(node: ObjectASTNode, schema: JSONSchema, originalSchema: JSONSchema, validationResult: ValidationResult, matchingSchemas: ISchemaCollector, options: Options): void;
|
||||
protected applyRequired(node: ObjectASTNode, schema: JSONSchema, originalSchema: JSONSchema, validationResult: ValidationResult, _options: Options, seenKeys: Record<string, ASTNode>): void;
|
||||
protected applyProperties(_node: ObjectASTNode, schema: JSONSchema, originalSchema: JSONSchema, validationResult: ValidationResult, matchingSchemas: ISchemaCollector, options: Options, seenKeys: Record<string, ASTNode>, _unprocessedProperties: string[], propertyProcessed: (prop: string) => void): void;
|
||||
protected applyPatternProperties(_node: ObjectASTNode, schema: JSONSchema, originalSchema: JSONSchema, validationResult: ValidationResult, matchingSchemas: ISchemaCollector, options: Options, seenKeys: Record<string, ASTNode>, unprocessedProperties: string[], propertyProcessed: (prop: string) => void): void;
|
||||
protected applyAdditionalProperties(_node: ObjectASTNode, schema: JSONSchema, originalSchema: JSONSchema, validationResult: ValidationResult, matchingSchemas: ISchemaCollector, options: Options, seenKeys: Record<string, ASTNode>, unprocessedProperties: string[]): void;
|
||||
protected applyPropertyCount(node: ObjectASTNode, schema: JSONSchema, originalSchema: JSONSchema, validationResult: ValidationResult): void;
|
||||
protected applyDependencies(node: ObjectASTNode, schema: JSONSchema, originalSchema: JSONSchema, validationResult: ValidationResult, matchingSchemas: ISchemaCollector, options: Options, seenKeys: Record<string, ASTNode>): void;
|
||||
protected applyPropertyNames(node: ObjectASTNode, schema: JSONSchema, validationResult: ValidationResult, options: Options): void;
|
||||
protected applyUnevaluatedProperties(_node: ObjectASTNode, _schema: JSONSchema, _originalSchema: JSONSchema, _validationResult: ValidationResult, _matchingSchemas: ISchemaCollector, _options: Options, _seenKeys?: Record<string, ASTNode>, _unprocessedProperties?: string[]): void;
|
||||
protected applyUnevaluatedItems(_node: ArrayASTNode | ASTNode, _schema: JSONSchema, _originalSchema: JSONSchema, _validationResult: ValidationResult, _matchingSchemas: ISchemaCollector, _options: Options): void;
|
||||
protected alternativeComparison(subValidationResult: ValidationResult, bestMatch: IValidationMatch, subSchema: JSONSchema, subMatchingSchemas: ISchemaCollector): IValidationMatch;
|
||||
protected genericComparison(node: ASTNode, maxOneMatch: boolean, subValidationResult: ValidationResult, bestMatch: IValidationMatch, subSchema: JSONSchema, subMatchingSchemas: ISchemaCollector): IValidationMatch;
|
||||
protected mergeValidationMatches(bestMatch: IValidationMatch, subMatchingSchemas: ISchemaCollector, subValidationResult: ValidationResult): void;
|
||||
}
|
||||
export declare function asSchema(schema: JSONSchemaRef): JSONSchema | undefined;
|
||||
export {};
|
||||
Generated
Vendored
+1270
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
Generated
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
import type { JSONSchema } from '../../jsonSchema';
|
||||
import { SchemaDialect } from '../../jsonSchema';
|
||||
import { BaseValidator } from './baseValidator';
|
||||
export declare class Draft04Validator extends BaseValidator {
|
||||
protected getCurrentDialect(): SchemaDialect;
|
||||
/**
|
||||
* Keyword: exclusiveMinimum/exclusiveMaximum
|
||||
*
|
||||
* Booleans that make minimum/maximum exclusive.
|
||||
*/
|
||||
protected getNumberLimits(schema: JSONSchema): {
|
||||
minimum?: number;
|
||||
maximum?: number;
|
||||
exclusiveMinimum?: number;
|
||||
exclusiveMaximum?: number;
|
||||
};
|
||||
}
|
||||
Generated
Vendored
+44
@@ -0,0 +1,44 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) IBM Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
(function (factory) {
|
||||
if (typeof module === "object" && typeof module.exports === "object") {
|
||||
var v = factory(require, exports);
|
||||
if (v !== undefined) module.exports = v;
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
define(["require", "exports", "../../jsonSchema", "../../utils/objects", "./baseValidator"], factory);
|
||||
}
|
||||
})(function (require, exports) {
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Draft04Validator = void 0;
|
||||
const jsonSchema_1 = require("../../jsonSchema");
|
||||
const objects_1 = require("../../utils/objects");
|
||||
const baseValidator_1 = require("./baseValidator");
|
||||
class Draft04Validator extends baseValidator_1.BaseValidator {
|
||||
getCurrentDialect() {
|
||||
return jsonSchema_1.SchemaDialect.draft04;
|
||||
}
|
||||
/**
|
||||
* Keyword: exclusiveMinimum/exclusiveMaximum
|
||||
*
|
||||
* Booleans that make minimum/maximum exclusive.
|
||||
*/
|
||||
getNumberLimits(schema) {
|
||||
const minimum = (0, objects_1.isNumber)(schema.minimum) ? schema.minimum : undefined;
|
||||
const maximum = (0, objects_1.isNumber)(schema.maximum) ? schema.maximum : undefined;
|
||||
const exclusiveMinimum = (0, objects_1.isBoolean)(schema.exclusiveMinimum) && schema.exclusiveMinimum ? minimum : undefined;
|
||||
const exclusiveMaximum = (0, objects_1.isBoolean)(schema.exclusiveMaximum) && schema.exclusiveMaximum ? maximum : undefined;
|
||||
return {
|
||||
minimum: exclusiveMinimum === undefined ? minimum : undefined,
|
||||
maximum: exclusiveMaximum === undefined ? maximum : undefined,
|
||||
exclusiveMinimum,
|
||||
exclusiveMaximum,
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.Draft04Validator = Draft04Validator;
|
||||
});
|
||||
//# sourceMappingURL=draft04Validator.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"draft04Validator.js","sourceRoot":"","sources":["../../../../../src/languageservice/parser/schemaValidation/draft04Validator.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;;;;IAGhG,iDAAiD;IACjD,iDAA0D;IAC1D,mDAAgD;IAEhD,MAAa,gBAAiB,SAAQ,6BAAa;QAC9B,iBAAiB;YAClC,OAAO,0BAAa,CAAC,OAAO,CAAC;QAC/B,CAAC;QAED;;;;WAIG;QACgB,eAAe,CAAC,MAAkB;YAMnD,MAAM,OAAO,GAAG,IAAA,kBAAQ,EAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;YACtE,MAAM,OAAO,GAAG,IAAA,kBAAQ,EAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;YAEtE,MAAM,gBAAgB,GAAG,IAAA,mBAAS,EAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;YAC7G,MAAM,gBAAgB,GAAG,IAAA,mBAAS,EAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;YAE7G,OAAO;gBACL,OAAO,EAAE,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;gBAC7D,OAAO,EAAE,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;gBAC7D,gBAAgB;gBAChB,gBAAgB;aACjB,CAAC;QACJ,CAAC;KACF;IA7BD,4CA6BC"}
|
||||
Generated
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
import type { JSONSchema } from '../../jsonSchema';
|
||||
import { SchemaDialect } from '../../jsonSchema';
|
||||
import { BaseValidator } from './baseValidator';
|
||||
export declare class Draft07Validator extends BaseValidator {
|
||||
protected getCurrentDialect(): SchemaDialect;
|
||||
/**
|
||||
* Keyword: exclusiveMinimum/exclusiveMaximum are treated as numeric bounds
|
||||
*/
|
||||
protected getNumberLimits(schema: JSONSchema): {
|
||||
minimum?: number;
|
||||
maximum?: number;
|
||||
exclusiveMinimum?: number;
|
||||
exclusiveMaximum?: number;
|
||||
};
|
||||
}
|
||||
Generated
Vendored
+42
@@ -0,0 +1,42 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) IBM Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
(function (factory) {
|
||||
if (typeof module === "object" && typeof module.exports === "object") {
|
||||
var v = factory(require, exports);
|
||||
if (v !== undefined) module.exports = v;
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
define(["require", "exports", "../../jsonSchema", "../../utils/objects", "./baseValidator"], factory);
|
||||
}
|
||||
})(function (require, exports) {
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Draft07Validator = void 0;
|
||||
const jsonSchema_1 = require("../../jsonSchema");
|
||||
const objects_1 = require("../../utils/objects");
|
||||
const baseValidator_1 = require("./baseValidator");
|
||||
class Draft07Validator extends baseValidator_1.BaseValidator {
|
||||
getCurrentDialect() {
|
||||
return jsonSchema_1.SchemaDialect.draft07;
|
||||
}
|
||||
/**
|
||||
* Keyword: exclusiveMinimum/exclusiveMaximum are treated as numeric bounds
|
||||
*/
|
||||
getNumberLimits(schema) {
|
||||
const minimum = (0, objects_1.isNumber)(schema.minimum) ? schema.minimum : undefined;
|
||||
const maximum = (0, objects_1.isNumber)(schema.maximum) ? schema.maximum : undefined;
|
||||
const exclusiveMinimum = (0, objects_1.isNumber)(schema.exclusiveMinimum) ? schema.exclusiveMinimum : undefined;
|
||||
const exclusiveMaximum = (0, objects_1.isNumber)(schema.exclusiveMaximum) ? schema.exclusiveMaximum : undefined;
|
||||
return {
|
||||
minimum: exclusiveMinimum === undefined ? minimum : undefined,
|
||||
maximum: exclusiveMaximum === undefined ? maximum : undefined,
|
||||
exclusiveMinimum,
|
||||
exclusiveMaximum,
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.Draft07Validator = Draft07Validator;
|
||||
});
|
||||
//# sourceMappingURL=draft07Validator.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"draft07Validator.js","sourceRoot":"","sources":["../../../../../src/languageservice/parser/schemaValidation/draft07Validator.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;;;;IAGhG,iDAAiD;IACjD,iDAA+C;IAC/C,mDAAgD;IAEhD,MAAa,gBAAiB,SAAQ,6BAAa;QAC9B,iBAAiB;YAClC,OAAO,0BAAa,CAAC,OAAO,CAAC;QAC/B,CAAC;QAED;;WAEG;QACO,eAAe,CAAC,MAAkB;YAM1C,MAAM,OAAO,GAAG,IAAA,kBAAQ,EAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;YACtE,MAAM,OAAO,GAAG,IAAA,kBAAQ,EAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;YAEtE,MAAM,gBAAgB,GAAG,IAAA,kBAAQ,EAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS,CAAC;YACjG,MAAM,gBAAgB,GAAG,IAAA,kBAAQ,EAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS,CAAC;YAEjG,OAAO;gBACL,OAAO,EAAE,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;gBAC7D,OAAO,EAAE,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;gBAC7D,gBAAgB;gBAChB,gBAAgB;aACjB,CAAC;QACJ,CAAC;KACF;IA3BD,4CA2BC"}
|
||||
Generated
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
import type { JSONSchema } from '../../jsonSchema';
|
||||
import { SchemaDialect } from '../../jsonSchema';
|
||||
import type { ASTNode, ArrayASTNode, ObjectASTNode } from '../../jsonASTTypes';
|
||||
import { Draft07Validator } from './draft07Validator';
|
||||
import { ValidationResult } from './baseValidator';
|
||||
import type { ISchemaCollector, Options } from './baseValidator';
|
||||
export declare class Draft2019Validator extends Draft07Validator {
|
||||
protected getCurrentDialect(): SchemaDialect;
|
||||
/**
|
||||
* Keyword: contains + minContains/maxContains
|
||||
*
|
||||
* Draft-07 behavior: contains must match at least 1 item.
|
||||
* Draft-2019-09 behavior: minContains/maxContains constrain how many matches are required/allowed.
|
||||
*/
|
||||
protected applyContains(node: ArrayASTNode, schema: JSONSchema, originalSchema: JSONSchema, validationResult: ValidationResult, _matchingSchemas: ISchemaCollector, options: Options): void;
|
||||
/**
|
||||
* Keyword: dependentRequired + dependentSchemas.
|
||||
*/
|
||||
protected applyDependencies(node: ObjectASTNode, schema: JSONSchema, originalSchema: JSONSchema, validationResult: ValidationResult, matchingSchemas: ISchemaCollector, options: Options, seenKeys: Record<string, ASTNode>): void;
|
||||
/**
|
||||
* Keyword: unevaluatedProperties
|
||||
*/
|
||||
protected applyUnevaluatedProperties(node: ObjectASTNode, schema: JSONSchema, originalSchema: JSONSchema, validationResult: ValidationResult, matchingSchemas: ISchemaCollector, options: Options, seenKeys?: Record<string, ASTNode>): void;
|
||||
/**
|
||||
* Keyword: unevaluatedItems
|
||||
*/
|
||||
protected applyUnevaluatedItems(node: ArrayASTNode, schema: JSONSchema, originalSchema: JSONSchema, validationResult: ValidationResult, matchingSchemas: ISchemaCollector, options: Options): void;
|
||||
}
|
||||
Generated
Vendored
+238
@@ -0,0 +1,238 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) IBM Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
(function (factory) {
|
||||
if (typeof module === "object" && typeof module.exports === "object") {
|
||||
var v = factory(require, exports);
|
||||
if (v !== undefined) module.exports = v;
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
define(["require", "exports", "../../jsonSchema", "../../utils/objects", "@vscode/l10n", "vscode-languageserver-types", "vscode-json-languageservice", "./draft07Validator", "./baseValidator"], factory);
|
||||
}
|
||||
})(function (require, exports) {
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Draft2019Validator = void 0;
|
||||
const jsonSchema_1 = require("../../jsonSchema");
|
||||
const objects_1 = require("../../utils/objects");
|
||||
const l10n = require("@vscode/l10n");
|
||||
const vscode_languageserver_types_1 = require("vscode-languageserver-types");
|
||||
const vscode_json_languageservice_1 = require("vscode-json-languageservice");
|
||||
const draft07Validator_1 = require("./draft07Validator");
|
||||
const baseValidator_1 = require("./baseValidator");
|
||||
class Draft2019Validator extends draft07Validator_1.Draft07Validator {
|
||||
getCurrentDialect() {
|
||||
return jsonSchema_1.SchemaDialect.draft2019;
|
||||
}
|
||||
/**
|
||||
* Keyword: contains + minContains/maxContains
|
||||
*
|
||||
* Draft-07 behavior: contains must match at least 1 item.
|
||||
* Draft-2019-09 behavior: minContains/maxContains constrain how many matches are required/allowed.
|
||||
*/
|
||||
applyContains(node, schema, originalSchema, validationResult, _matchingSchemas, options) {
|
||||
const containsSchema = (0, baseValidator_1.asSchema)(schema.contains);
|
||||
if (!containsSchema)
|
||||
return;
|
||||
const minContainsRaw = schema.minContains;
|
||||
const maxContainsRaw = schema.maxContains;
|
||||
const minContains = (0, objects_1.isNumber)(minContainsRaw) ? minContainsRaw : 1;
|
||||
const maxContains = (0, objects_1.isNumber)(maxContainsRaw) ? maxContainsRaw : undefined;
|
||||
let matchCount = 0;
|
||||
const items = (node.items ?? []);
|
||||
for (const item of items) {
|
||||
const itemValidationResult = new baseValidator_1.ValidationResult(options.isKubernetes);
|
||||
this.validateNode(item, containsSchema, schema, itemValidationResult, this.getNoOpCollector(), options);
|
||||
if (!itemValidationResult.hasProblems()) {
|
||||
matchCount++;
|
||||
if (maxContains !== undefined && matchCount > maxContains) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (matchCount < minContains) {
|
||||
validationResult.problems.push({
|
||||
location: { offset: node.offset, length: node.length },
|
||||
severity: vscode_languageserver_types_1.DiagnosticSeverity.Warning,
|
||||
message: schema.errorMessage || l10n.t('Array has too few items matching "contains". Expected {0} or more.', minContains),
|
||||
source: this.getSchemaSource(schema, originalSchema),
|
||||
schemaUri: this.getSchemaUri(schema, originalSchema),
|
||||
});
|
||||
}
|
||||
if (maxContains !== undefined && matchCount > maxContains) {
|
||||
validationResult.problems.push({
|
||||
location: { offset: node.offset, length: node.length },
|
||||
severity: vscode_languageserver_types_1.DiagnosticSeverity.Warning,
|
||||
message: schema.errorMessage || l10n.t('Array has too many items matching "contains". Expected {0} or fewer.', maxContains),
|
||||
source: this.getSchemaSource(schema, originalSchema),
|
||||
schemaUri: this.getSchemaUri(schema, originalSchema),
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Keyword: dependentRequired + dependentSchemas.
|
||||
*/
|
||||
applyDependencies(node, schema, originalSchema, validationResult, matchingSchemas, options, seenKeys) {
|
||||
// keep draft-07 dependencies support
|
||||
super.applyDependencies(node, schema, originalSchema, validationResult, matchingSchemas, options, seenKeys);
|
||||
const dependentRequired = schema.dependentRequired;
|
||||
if (dependentRequired && typeof dependentRequired === 'object') {
|
||||
for (const prop of Object.keys(dependentRequired)) {
|
||||
if (!seenKeys[prop])
|
||||
continue;
|
||||
const requiredProps = dependentRequired[prop];
|
||||
if (!Array.isArray(requiredProps))
|
||||
continue;
|
||||
for (const requiredProp of requiredProps) {
|
||||
if (!seenKeys[requiredProp]) {
|
||||
validationResult.problems.push({
|
||||
location: { offset: node.offset, length: node.length },
|
||||
severity: vscode_languageserver_types_1.DiagnosticSeverity.Warning,
|
||||
message: l10n.t('Object is missing property {0} required by property {1}.', requiredProp, prop),
|
||||
source: this.getSchemaSource(schema, originalSchema),
|
||||
schemaUri: this.getSchemaUri(schema, originalSchema),
|
||||
});
|
||||
}
|
||||
else {
|
||||
validationResult.propertiesValueMatches++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const dependentSchemas = schema.dependentSchemas;
|
||||
if (dependentSchemas && typeof dependentSchemas === 'object') {
|
||||
for (const prop of Object.keys(dependentSchemas)) {
|
||||
if (!seenKeys[prop])
|
||||
continue;
|
||||
const depSchema = (0, baseValidator_1.asSchema)(dependentSchemas[prop]);
|
||||
if (!depSchema)
|
||||
continue;
|
||||
const depValidationResult = new baseValidator_1.ValidationResult(options.isKubernetes);
|
||||
this.validateNode(node, depSchema, schema, depValidationResult, matchingSchemas, options);
|
||||
validationResult.mergePropertyMatch(depValidationResult);
|
||||
validationResult.mergeEnumValues(depValidationResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Keyword: unevaluatedProperties
|
||||
*/
|
||||
applyUnevaluatedProperties(node, schema, originalSchema, validationResult, matchingSchemas, options, seenKeys) {
|
||||
const unevaluated = schema.unevaluatedProperties;
|
||||
if (unevaluated === undefined)
|
||||
return;
|
||||
if (!seenKeys)
|
||||
return;
|
||||
// ensure evaluatedProperties exists
|
||||
validationResult.evaluatedProperties ?? (validationResult.evaluatedProperties = new Set());
|
||||
// remaining = properties not evaluated by properties/patternProperties/additionalProperties
|
||||
const remaining = Object.keys(seenKeys).filter((name) => !validationResult.evaluatedProperties?.has(name));
|
||||
if (remaining.length === 0)
|
||||
return;
|
||||
// unevaluatedProperties: false => forbid remaining properties
|
||||
if (unevaluated === false) {
|
||||
for (const propName of remaining) {
|
||||
const child = seenKeys[propName];
|
||||
if (!child)
|
||||
continue;
|
||||
const propertyNode = child.type === 'property' ? child : child.parent;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const keyNode = propertyNode.keyNode;
|
||||
if (!keyNode)
|
||||
continue;
|
||||
validationResult.problems.push({
|
||||
location: { offset: keyNode.offset, length: keyNode.length },
|
||||
severity: vscode_languageserver_types_1.DiagnosticSeverity.Warning,
|
||||
code: vscode_json_languageservice_1.ErrorCode.PropertyExpected,
|
||||
message: schema.errorMessage || l10n.t('Property {0} is not allowed.', propName),
|
||||
source: this.getSchemaSource(schema, originalSchema),
|
||||
schemaUri: this.getSchemaUri(schema, originalSchema),
|
||||
});
|
||||
validationResult.evaluatedProperties?.add(propName);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// unevaluatedProperties: true => allow anything remaining, but mark evaluated
|
||||
if (unevaluated === true) {
|
||||
for (const propName of remaining) {
|
||||
validationResult.evaluatedProperties?.add(propName);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// unevaluatedProperties: <schema> => validate value of each remaining property
|
||||
const unevaluatedSchema = (0, baseValidator_1.asSchema)(unevaluated);
|
||||
if (!unevaluatedSchema)
|
||||
return;
|
||||
for (const propName of remaining) {
|
||||
const child = seenKeys[propName];
|
||||
if (!child)
|
||||
continue;
|
||||
const valueNode = child.type === 'property' ? child.valueNode : child;
|
||||
if (!valueNode)
|
||||
continue;
|
||||
const subResult = new baseValidator_1.ValidationResult(options.isKubernetes);
|
||||
this.validateNode(valueNode, unevaluatedSchema, schema, subResult, matchingSchemas, options);
|
||||
validationResult.mergePropertyMatch(subResult);
|
||||
validationResult.mergeEnumValues(subResult);
|
||||
validationResult.evaluatedProperties?.add(propName);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Keyword: unevaluatedItems
|
||||
*/
|
||||
applyUnevaluatedItems(node, schema, originalSchema, validationResult, matchingSchemas, options) {
|
||||
const unevaluated = schema.unevaluatedItems;
|
||||
if (unevaluated === undefined)
|
||||
return;
|
||||
const items = (node.items ?? []);
|
||||
if (items.length === 0)
|
||||
return;
|
||||
const evaluated = validationResult.getEvaluatedItems(node);
|
||||
const remaining = [];
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
if (!evaluated.has(i))
|
||||
remaining.push(i);
|
||||
}
|
||||
if (remaining.length === 0)
|
||||
return;
|
||||
// unevaluatedItems: false => forbid remaining indices
|
||||
if (unevaluated === false) {
|
||||
for (const idx of remaining) {
|
||||
const item = items[idx];
|
||||
validationResult.problems.push({
|
||||
location: { offset: item.offset, length: item.length || 1 },
|
||||
severity: vscode_languageserver_types_1.DiagnosticSeverity.Warning,
|
||||
code: vscode_json_languageservice_1.ErrorCode.PropertyExpected,
|
||||
message: schema.errorMessage || l10n.t('Array has too many items according to schema. Expected {0} or fewer.', idx),
|
||||
source: this.getSchemaSource(schema, originalSchema),
|
||||
schemaUri: this.getSchemaUri(schema, originalSchema),
|
||||
});
|
||||
evaluated.add(idx);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// unevaluatedItems: true => allow everything remaining, but mark evaluated
|
||||
if (unevaluated === true) {
|
||||
for (const idx of remaining)
|
||||
evaluated.add(idx);
|
||||
return;
|
||||
}
|
||||
// unevaluatedItems: <schema> => validate remaining items against that schema
|
||||
const unevaluatedSchema = (0, baseValidator_1.asSchema)(unevaluated);
|
||||
if (!unevaluatedSchema)
|
||||
return;
|
||||
for (const idx of remaining) {
|
||||
const item = items[idx];
|
||||
const subResult = new baseValidator_1.ValidationResult(options.isKubernetes);
|
||||
// validate the item node with the unevaluatedItems subschema
|
||||
this.validateNode(item, unevaluatedSchema, schema, subResult, matchingSchemas, options);
|
||||
validationResult.merge(subResult);
|
||||
validationResult.mergeEnumValues(subResult);
|
||||
evaluated.add(idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.Draft2019Validator = Draft2019Validator;
|
||||
});
|
||||
//# sourceMappingURL=draft2019Validator.js.map
|
||||
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
Generated
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
import type { JSONSchema } from '../../jsonSchema';
|
||||
import { SchemaDialect } from '../../jsonSchema';
|
||||
import type { ArrayASTNode } from '../../jsonASTTypes';
|
||||
import { Draft2019Validator } from './draft2019Validator';
|
||||
import type { ISchemaCollector, Options } from './baseValidator';
|
||||
import { ValidationResult } from './baseValidator';
|
||||
export declare class Draft2020Validator extends Draft2019Validator {
|
||||
protected getCurrentDialect(): SchemaDialect;
|
||||
/**
|
||||
* Keyword: prefixItems + items
|
||||
*/
|
||||
protected validateArrayNode(node: ArrayASTNode, schema: JSONSchema, originalSchema: JSONSchema, validationResult: ValidationResult, matchingSchemas: ISchemaCollector, options: Options): void;
|
||||
/**
|
||||
* Draft 2020-12: contains keyword affects the unevaluatedItems keyword
|
||||
*/
|
||||
protected applyContains(node: ArrayASTNode, schema: JSONSchema, originalSchema: JSONSchema, validationResult: ValidationResult, _matchingSchemas: ISchemaCollector, options: Options): void;
|
||||
}
|
||||
Generated
Vendored
+140
@@ -0,0 +1,140 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) IBM Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
(function (factory) {
|
||||
if (typeof module === "object" && typeof module.exports === "object") {
|
||||
var v = factory(require, exports);
|
||||
if (v !== undefined) module.exports = v;
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
define(["require", "exports", "../../jsonSchema", "../../utils/objects", "@vscode/l10n", "vscode-languageserver-types", "./draft2019Validator", "./baseValidator"], factory);
|
||||
}
|
||||
})(function (require, exports) {
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Draft2020Validator = void 0;
|
||||
const jsonSchema_1 = require("../../jsonSchema");
|
||||
const objects_1 = require("../../utils/objects");
|
||||
const l10n = require("@vscode/l10n");
|
||||
const vscode_languageserver_types_1 = require("vscode-languageserver-types");
|
||||
const draft2019Validator_1 = require("./draft2019Validator");
|
||||
const baseValidator_1 = require("./baseValidator");
|
||||
class Draft2020Validator extends draft2019Validator_1.Draft2019Validator {
|
||||
getCurrentDialect() {
|
||||
return jsonSchema_1.SchemaDialect.draft2020;
|
||||
}
|
||||
/**
|
||||
* Keyword: prefixItems + items
|
||||
*/
|
||||
validateArrayNode(node, schema, originalSchema, validationResult, matchingSchemas, options) {
|
||||
const items = (node.items ?? []);
|
||||
// prefixItems/items/contains contribute to evaluatedItems
|
||||
const evaluatedItems = validationResult.getEvaluatedItems(node);
|
||||
const prefixItems = schema.prefixItems;
|
||||
// validate prefixItems
|
||||
if (Array.isArray(prefixItems)) {
|
||||
const limit = Math.min(prefixItems.length, items.length);
|
||||
for (let i = 0; i < limit; i++) {
|
||||
const subSchema = (0, baseValidator_1.asSchema)(prefixItems[i]);
|
||||
if (!subSchema) {
|
||||
evaluatedItems.add(i);
|
||||
continue;
|
||||
}
|
||||
const itemValidationResult = new baseValidator_1.ValidationResult(options.isKubernetes);
|
||||
this.validateNode(items[i], subSchema, schema, itemValidationResult, matchingSchemas, options);
|
||||
validationResult.mergePropertyMatch(itemValidationResult, false);
|
||||
validationResult.mergeEnumValues(itemValidationResult);
|
||||
// mark as evaluated even if invalid (avoids duplicate unevaluatedItems noise)
|
||||
evaluatedItems.add(i);
|
||||
}
|
||||
}
|
||||
// validate remaining items against items
|
||||
const itemsKeyword = schema.items;
|
||||
const prefixLen = Array.isArray(prefixItems) ? prefixItems.length : 0;
|
||||
if (items.length > prefixLen) {
|
||||
if (itemsKeyword === false) {
|
||||
// "items": false => no items allowed beyond prefixItems
|
||||
validationResult.problems.push({
|
||||
location: { offset: node.offset, length: node.length },
|
||||
severity: vscode_languageserver_types_1.DiagnosticSeverity.Warning,
|
||||
message: l10n.t('Array has too many items according to schema. Expected {0} or fewer.', prefixLen),
|
||||
source: this.getSchemaSource(schema, originalSchema),
|
||||
schemaUri: this.getSchemaUri(schema, originalSchema),
|
||||
});
|
||||
// mark these as evaluated by "items": false (so unevaluatedItems doesn't also complain)
|
||||
for (let i = prefixLen; i < items.length; i++) {
|
||||
evaluatedItems.add(i);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const tailSchema = (0, baseValidator_1.asSchema)(itemsKeyword);
|
||||
// if items is undefined, there's no constraint for remaining items and they remain unevaluated
|
||||
if (tailSchema) {
|
||||
for (let i = prefixLen; i < items.length; i++) {
|
||||
const itemValidationResult = new baseValidator_1.ValidationResult(options.isKubernetes);
|
||||
this.validateNode(items[i], tailSchema, schema, itemValidationResult, matchingSchemas, options);
|
||||
validationResult.mergePropertyMatch(itemValidationResult, false);
|
||||
validationResult.mergeEnumValues(itemValidationResult);
|
||||
// mark as evaluated even if invalid (avoids duplicate unevaluatedItems noise)
|
||||
evaluatedItems.add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// contains enforces min/max and marks matching indices as evaluated
|
||||
this.applyContains(node, schema, originalSchema, validationResult, matchingSchemas, options);
|
||||
// generic array keywords
|
||||
this.applyArrayLength(node, schema, originalSchema, validationResult, options);
|
||||
this.applyUniqueItems(node, schema, originalSchema, validationResult);
|
||||
}
|
||||
/**
|
||||
* Draft 2020-12: contains keyword affects the unevaluatedItems keyword
|
||||
*/
|
||||
applyContains(node, schema, originalSchema, validationResult, _matchingSchemas, options) {
|
||||
const containsSchema = (0, baseValidator_1.asSchema)(schema.contains);
|
||||
if (!containsSchema)
|
||||
return;
|
||||
const items = (node.items ?? []);
|
||||
const minContainsRaw = schema.minContains;
|
||||
const maxContainsRaw = schema.maxContains;
|
||||
const minContains = (0, objects_1.isNumber)(minContainsRaw) ? minContainsRaw : 1;
|
||||
const maxContains = (0, objects_1.isNumber)(maxContainsRaw) ? maxContainsRaw : undefined;
|
||||
let matchCount = 0;
|
||||
// ensure evaluatedItems exists
|
||||
const evaluatedItems = validationResult.getEvaluatedItems(node);
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
const itemValidationResult = new baseValidator_1.ValidationResult(options.isKubernetes);
|
||||
this.validateNode(items[i], containsSchema, schema, itemValidationResult, this.getNoOpCollector(), options);
|
||||
if (!itemValidationResult.hasProblems()) {
|
||||
// items that match contains are considered evaluated
|
||||
evaluatedItems.add(i);
|
||||
matchCount++;
|
||||
if (maxContains !== undefined && matchCount > maxContains) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (matchCount < minContains) {
|
||||
validationResult.problems.push({
|
||||
location: { offset: node.offset, length: node.length },
|
||||
severity: vscode_languageserver_types_1.DiagnosticSeverity.Warning,
|
||||
message: schema.errorMessage || l10n.t('Array has too few items matching "contains". Expected {0} or more.', minContains),
|
||||
source: this.getSchemaSource(schema, originalSchema),
|
||||
schemaUri: this.getSchemaUri(schema, originalSchema),
|
||||
});
|
||||
}
|
||||
if (maxContains !== undefined && matchCount > maxContains) {
|
||||
validationResult.problems.push({
|
||||
location: { offset: node.offset, length: node.length },
|
||||
severity: vscode_languageserver_types_1.DiagnosticSeverity.Warning,
|
||||
message: schema.errorMessage || l10n.t('Array has too many items matching "contains". Expected {0} or fewer.', maxContains),
|
||||
source: this.getSchemaSource(schema, originalSchema),
|
||||
schemaUri: this.getSchemaUri(schema, originalSchema),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.Draft2020Validator = Draft2020Validator;
|
||||
});
|
||||
//# sourceMappingURL=draft2020Validator.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"draft2020Validator.js","sourceRoot":"","sources":["../../../../../src/languageservice/parser/schemaValidation/draft2020Validator.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;;;;IAGhG,iDAAiD;IAEjD,iDAA+C;IAC/C,qCAAqC;IACrC,6EAAiE;IACjE,6DAA0D;IAE1D,mDAA6D;IAE7D,MAAa,kBAAmB,SAAQ,uCAAkB;QACrC,iBAAiB;YAClC,OAAO,0BAAa,CAAC,SAAS,CAAC;QACjC,CAAC;QAED;;WAEG;QACgB,iBAAiB,CAClC,IAAkB,EAClB,MAAkB,EAClB,cAA0B,EAC1B,gBAAkC,EAClC,eAAiC,EACjC,OAAgB;YAEhB,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAc,CAAC;YAC9C,0DAA0D;YAC1D,MAAM,cAAc,GAAG,gBAAgB,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;YAEhE,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;YACvC,uBAAuB;YACvB,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;gBAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;gBACzD,KAAK,IAAI,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';
|
||||
export declare function getValidator(dialect: SchemaDialect): BaseValidator;
|
||||
Generated
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) IBM Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
(function (factory) {
|
||||
if (typeof module === "object" && typeof module.exports === "object") {
|
||||
var v = factory(require, exports);
|
||||
if (v !== undefined) module.exports = v;
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
define(["require", "exports", "../../jsonSchema", "./draft04Validator", "./draft07Validator", "./draft2019Validator", "./draft2020Validator"], factory);
|
||||
}
|
||||
})(function (require, exports) {
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getValidator = void 0;
|
||||
const jsonSchema_1 = require("../../jsonSchema");
|
||||
const draft04Validator_1 = require("./draft04Validator");
|
||||
const draft07Validator_1 = require("./draft07Validator");
|
||||
const draft2019Validator_1 = require("./draft2019Validator");
|
||||
const draft2020Validator_1 = require("./draft2020Validator");
|
||||
function getValidator(dialect) {
|
||||
switch (dialect) {
|
||||
case jsonSchema_1.SchemaDialect.draft04:
|
||||
return new draft04Validator_1.Draft04Validator();
|
||||
case jsonSchema_1.SchemaDialect.draft07:
|
||||
return new draft07Validator_1.Draft07Validator();
|
||||
case jsonSchema_1.SchemaDialect.draft2019:
|
||||
return new draft2019Validator_1.Draft2019Validator();
|
||||
case jsonSchema_1.SchemaDialect.draft2020:
|
||||
return new draft2020Validator_1.Draft2020Validator();
|
||||
default:
|
||||
return new draft07Validator_1.Draft07Validator(); // fallback
|
||||
}
|
||||
}
|
||||
exports.getValidator = getValidator;
|
||||
});
|
||||
//# sourceMappingURL=validatorFactory.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"validatorFactory.js","sourceRoot":"","sources":["../../../../../src/languageservice/parser/schemaValidation/validatorFactory.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;;;;IAEhG,iDAAiD;IAEjD,yDAAsD;IACtD,yDAAsD;IACtD,6DAA0D;IAC1D,6DAA0D;IAE1D,SAAgB,YAAY,CAAC,OAAsB;QACjD,QAAQ,OAAO,EAAE;YACf,KAAK,0BAAa,CAAC,OAAO;gBACxB,OAAO,IAAI,mCAAgB,EAAE,CAAC;YAChC,KAAK,0BAAa,CAAC,OAAO;gBACxB,OAAO,IAAI,mCAAgB,EAAE,CAAC;YAChC,KAAK,0BAAa,CAAC,SAAS;gBAC1B,OAAO,IAAI,uCAAkB,EAAE,CAAC;YAClC,KAAK,0BAAa,CAAC,SAAS;gBAC1B,OAAO,IAAI,uCAAkB,EAAE,CAAC;YAClC;gBACE,OAAO,IAAI,mCAAgB,EAAE,CAAC,CAAC,WAAW;SAC7C;IACH,CAAC;IAbD,oCAaC"}
|
||||
Reference in New Issue
Block a user