@lionweb/validation 0.7.0-beta.10 → 0.7.0-beta.12
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 +7 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/issues/LanguageIssues.d.ts +99 -0
- package/dist/issues/LanguageIssues.d.ts.map +1 -0
- package/dist/issues/LanguageIssues.js +146 -0
- package/dist/issues/LanguageIssues.js.map +1 -0
- package/dist/issues/ReferenceIssues.d.ts +43 -0
- package/dist/issues/ReferenceIssues.d.ts.map +1 -0
- package/dist/issues/ReferenceIssues.js +53 -0
- package/dist/issues/ReferenceIssues.js.map +1 -0
- package/dist/issues/SyntaxIssues.d.ts +53 -0
- package/dist/issues/SyntaxIssues.d.ts.map +1 -0
- package/dist/issues/SyntaxIssues.js +81 -0
- package/dist/issues/SyntaxIssues.js.map +1 -0
- package/dist/issues/ValidationIssue.d.ts +15 -0
- package/dist/issues/ValidationIssue.d.ts.map +1 -0
- package/dist/issues/ValidationIssue.js +17 -0
- package/dist/issues/ValidationIssue.js.map +1 -0
- package/dist/issues/index.d.ts +5 -0
- package/dist/issues/index.d.ts.map +1 -0
- package/dist/issues/index.js +5 -0
- package/dist/issues/index.js.map +1 -0
- package/dist/languages/CompositeLionWebLanguageWrapper.d.ts +24 -0
- package/dist/languages/CompositeLionWebLanguageWrapper.d.ts.map +1 -0
- package/dist/languages/CompositeLionWebLanguageWrapper.js +56 -0
- package/dist/languages/CompositeLionWebLanguageWrapper.js.map +1 -0
- package/dist/languages/LanguageRegistry.d.ts +19 -0
- package/dist/languages/LanguageRegistry.d.ts.map +1 -0
- package/dist/languages/LanguageRegistry.js +37 -0
- package/dist/languages/LanguageRegistry.js.map +1 -0
- package/dist/languages/LanguageUtils.d.ts +35 -0
- package/dist/languages/LanguageUtils.d.ts.map +1 -0
- package/dist/languages/LanguageUtils.js +54 -0
- package/dist/languages/LanguageUtils.js.map +1 -0
- package/dist/languages/LionWebLanguageWrapper.d.ts +31 -0
- package/dist/languages/LionWebLanguageWrapper.d.ts.map +1 -0
- package/dist/languages/LionWebLanguageWrapper.js +69 -0
- package/dist/languages/LionWebLanguageWrapper.js.map +1 -0
- package/dist/languages/MetaPointerMap.d.ts +11 -0
- package/dist/languages/MetaPointerMap.d.ts.map +1 -0
- package/dist/languages/MetaPointerMap.js +39 -0
- package/dist/languages/MetaPointerMap.js.map +1 -0
- package/dist/languages/index.d.ts +3 -0
- package/dist/languages/index.d.ts.map +1 -0
- package/dist/languages/index.js +3 -0
- package/dist/languages/index.js.map +1 -0
- package/dist/runners/FileUtils.d.ts +6 -0
- package/dist/runners/FileUtils.d.ts.map +1 -0
- package/dist/runners/FileUtils.js +53 -0
- package/dist/runners/FileUtils.js.map +1 -0
- package/dist/runners/RunCheckFolder.d.ts +2 -0
- package/dist/runners/RunCheckFolder.d.ts.map +1 -0
- package/dist/runners/RunCheckFolder.js +6 -0
- package/dist/runners/RunCheckFolder.js.map +1 -0
- package/dist/runners/RunCheckFolderWithLanguage.d.ts +2 -0
- package/dist/runners/RunCheckFolderWithLanguage.d.ts.map +1 -0
- package/dist/runners/RunCheckFolderWithLanguage.js +40 -0
- package/dist/runners/RunCheckFolderWithLanguage.js.map +1 -0
- package/dist/runners/RunCheckOneFile.d.ts +2 -0
- package/dist/runners/RunCheckOneFile.d.ts.map +1 -0
- package/dist/runners/RunCheckOneFile.js +6 -0
- package/dist/runners/RunCheckOneFile.js.map +1 -0
- package/dist/runners/RunCheckOneFileWithLanguage.d.ts +2 -0
- package/dist/runners/RunCheckOneFileWithLanguage.d.ts.map +1 -0
- package/dist/runners/RunCheckOneFileWithLanguage.js +31 -0
- package/dist/runners/RunCheckOneFileWithLanguage.js.map +1 -0
- package/dist/runners/RunLioncoreDiff.d.ts +2 -0
- package/dist/runners/RunLioncoreDiff.d.ts.map +1 -0
- package/dist/runners/RunLioncoreDiff.js +22 -0
- package/dist/runners/RunLioncoreDiff.js.map +1 -0
- package/dist/runners/Utils.d.ts +7 -0
- package/dist/runners/Utils.d.ts.map +1 -0
- package/dist/runners/Utils.js +48 -0
- package/dist/runners/Utils.js.map +1 -0
- package/dist/runners/index.d.ts +3 -0
- package/dist/runners/index.d.ts.map +1 -0
- package/dist/runners/index.js +3 -0
- package/dist/runners/index.js.map +1 -0
- package/dist/validators/LionWebChunkDefinitions.d.ts +9 -0
- package/dist/validators/LionWebChunkDefinitions.d.ts.map +1 -0
- package/{src/validators/LionWebChunkDefinitions.ts → dist/validators/LionWebChunkDefinitions.js} +10 -14
- package/dist/validators/LionWebChunkDefinitions.js.map +1 -0
- package/dist/validators/LionWebLanguageReferenceValidator.d.ts +21 -0
- package/dist/validators/LionWebLanguageReferenceValidator.d.ts.map +1 -0
- package/{src/validators/LionWebLanguageReferenceValidator.ts → dist/validators/LionWebLanguageReferenceValidator.js} +73 -108
- package/dist/validators/LionWebLanguageReferenceValidator.js.map +1 -0
- package/dist/validators/LionWebLanguageValidator.d.ts +23 -0
- package/dist/validators/LionWebLanguageValidator.d.ts.map +1 -0
- package/dist/validators/LionWebLanguageValidator.js +66 -0
- package/dist/validators/LionWebLanguageValidator.js.map +1 -0
- package/dist/validators/LionWebReferenceValidator.d.ts +43 -0
- package/dist/validators/LionWebReferenceValidator.d.ts.map +1 -0
- package/{src/validators/LionWebReferenceValidator.ts → dist/validators/LionWebReferenceValidator.js} +84 -106
- package/dist/validators/LionWebReferenceValidator.js.map +1 -0
- package/dist/validators/LionWebSyntaxValidator.d.ts +9 -0
- package/dist/validators/LionWebSyntaxValidator.d.ts.map +1 -0
- package/dist/validators/LionWebSyntaxValidator.js +11 -0
- package/dist/validators/LionWebSyntaxValidator.js.map +1 -0
- package/dist/validators/LionWebValidator.d.ts +24 -0
- package/dist/validators/LionWebValidator.d.ts.map +1 -0
- package/{src/validators/LionWebValidator.ts → dist/validators/LionWebValidator.js} +29 -45
- package/dist/validators/LionWebValidator.js.map +1 -0
- package/dist/validators/ValidationFunctions.d.ts +60 -0
- package/dist/validators/ValidationFunctions.d.ts.map +1 -0
- package/{src/validators/ValidationFunctions.ts → dist/validators/ValidationFunctions.js} +34 -66
- package/dist/validators/ValidationFunctions.js.map +1 -0
- package/dist/validators/generic/SyntaxValidator.d.ts +37 -0
- package/dist/validators/generic/SyntaxValidator.d.ts.map +1 -0
- package/dist/validators/generic/SyntaxValidator.js +152 -0
- package/dist/validators/generic/SyntaxValidator.js.map +1 -0
- package/dist/validators/generic/ValidationResult.d.ts +8 -0
- package/dist/validators/generic/ValidationResult.d.ts.map +1 -0
- package/dist/validators/generic/ValidationResult.js +15 -0
- package/dist/validators/generic/ValidationResult.js.map +1 -0
- package/dist/validators/generic/index.d.ts +4 -0
- package/dist/validators/generic/index.d.ts.map +1 -0
- package/dist/validators/generic/index.js +4 -0
- package/dist/validators/generic/index.js.map +1 -0
- package/dist/validators/generic/schema/DefinitionSchema.d.ts +23 -0
- package/dist/validators/generic/schema/DefinitionSchema.d.ts.map +1 -0
- package/dist/validators/generic/schema/DefinitionSchema.js +43 -0
- package/dist/validators/generic/schema/DefinitionSchema.js.map +1 -0
- package/dist/validators/generic/schema/ValidationTypes.d.ts +101 -0
- package/dist/validators/generic/schema/ValidationTypes.d.ts.map +1 -0
- package/dist/validators/generic/schema/ValidationTypes.js +43 -0
- package/dist/validators/generic/schema/ValidationTypes.js.map +1 -0
- package/dist/validators/generic/schema/index.d.ts +3 -0
- package/dist/validators/generic/schema/index.d.ts.map +1 -0
- package/dist/validators/generic/schema/index.js +3 -0
- package/dist/validators/generic/schema/index.js.map +1 -0
- package/dist/validators/index.d.ts +9 -0
- package/dist/validators/index.d.ts.map +1 -0
- package/dist/validators/index.js +9 -0
- package/dist/validators/index.js.map +1 -0
- package/package.json +4 -4
- package/src/index.ts +0 -4
- package/src/issues/LanguageIssues.ts +0 -147
- package/src/issues/ReferenceIssues.ts +0 -83
- package/src/issues/SyntaxIssues.ts +0 -84
- package/src/issues/ValidationIssue.ts +0 -29
- package/src/issues/index.ts +0 -4
- package/src/languages/CompositeLionWebLanguageWrapper.ts +0 -57
- package/src/languages/LanguageRegistry.ts +0 -44
- package/src/languages/LanguageUtils.ts +0 -63
- package/src/languages/LionWebLanguageWrapper.ts +0 -91
- package/src/languages/MetaPointerMap.ts +0 -41
- package/src/languages/index.ts +0 -2
- package/src/runners/FileUtils.ts +0 -59
- package/src/runners/RunCheckFolder.ts +0 -7
- package/src/runners/RunCheckFolderWithLanguage.ts +0 -45
- package/src/runners/RunCheckOneFile.ts +0 -7
- package/src/runners/RunCheckOneFileWithLanguage.ts +0 -35
- package/src/runners/RunLioncoreDiff.ts +0 -23
- package/src/runners/Utils.ts +0 -54
- package/src/runners/index.ts +0 -2
- package/src/validators/LionWebLanguageValidator.ts +0 -78
- package/src/validators/LionWebSyntaxValidator.ts +0 -14
- package/src/validators/generic/SyntaxValidator.ts +0 -216
- package/src/validators/generic/ValidationResult.ts +0 -17
- package/src/validators/generic/index.ts +0 -3
- package/src/validators/generic/schema/DefinitionSchema.ts +0 -52
- package/src/validators/generic/schema/ValidationTypes.ts +0 -134
- package/src/validators/generic/schema/index.ts +0 -2
- package/src/validators/index.ts +0 -8
- package/tsconfig.json +0 -8
- /package/{src → dist}/languages/LionCore-M3.json +0 -0
- /package/{src → dist}/languages/LionCore-builtins.json +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { isEqualMetaPointer } from "@lionweb/json";
|
|
2
|
+
import { isLionWebM3Language, JsonContext, LionWebJsonChunkWrapper, MetaPointers } from "@lionweb/json-utils";
|
|
3
|
+
import { GenericIssue } from "../issues/index.js";
|
|
4
|
+
import { MissingM3Language_Issue } from "../issues/LanguageIssues.js";
|
|
5
|
+
import { isConcept } from "../languages/index.js";
|
|
6
|
+
/**
|
|
7
|
+
* Validates whether a chunk is a valid language definition
|
|
8
|
+
*/
|
|
9
|
+
export class LionWebLanguageValidator {
|
|
10
|
+
// availableLanguages: LionWebLanguageDefinition[] = []
|
|
11
|
+
constructor(validationResult, registry) {
|
|
12
|
+
this.registry = registry;
|
|
13
|
+
this.validationResult = validationResult;
|
|
14
|
+
this.chunkWrapper = undefined;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Check whether the metamodel is a Language.
|
|
18
|
+
* Assumption is that _chunk_ is already validated as a correct :LionWebJsonChunk
|
|
19
|
+
* @param chunk
|
|
20
|
+
*/
|
|
21
|
+
validateLanguage(chunk) {
|
|
22
|
+
this.chunkWrapper = new LionWebJsonChunkWrapper(chunk);
|
|
23
|
+
const usedM3Language = chunk.languages.find(lang => isLionWebM3Language(lang));
|
|
24
|
+
if (usedM3Language === undefined) {
|
|
25
|
+
this.validationResult.issue(new MissingM3Language_Issue(new JsonContext(null, ["languages"])));
|
|
26
|
+
}
|
|
27
|
+
const languageNodes = this.chunkWrapper.findNodesOfClassifier(MetaPointers.Language);
|
|
28
|
+
if (languageNodes.length !== 1) {
|
|
29
|
+
// TODO Better error handling.
|
|
30
|
+
console.error("Error: xpected exactly one Language node, found " + languageNodes.length + " => " + JSON.stringify(languageNodes));
|
|
31
|
+
}
|
|
32
|
+
chunk.nodes.forEach((node, index) => {
|
|
33
|
+
if (!isConcept(node)) {
|
|
34
|
+
this.validationResult.issue(new GenericIssue(new JsonContext(null, ["nodes", index]), `node ${node.id} is not a concept`));
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
this.validateConcept(node);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
validateConcept(node) {
|
|
42
|
+
node.properties.forEach(prop => {
|
|
43
|
+
const properties = this.chunkWrapper?.findNodesOfClassifier(MetaPointers.Property);
|
|
44
|
+
const matchedProperty = properties?.find(p => isEqualMetaPointer(p.classifier, prop.property));
|
|
45
|
+
// DUMMY
|
|
46
|
+
return matchedProperty !== undefined;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
validateNode(node) {
|
|
50
|
+
const classifier = this.registry.getNodeByMetaPointer(node.classifier);
|
|
51
|
+
if (classifier === undefined) {
|
|
52
|
+
this.validationResult.issue(new GenericIssue(new JsonContext(null, ["nodes"]), `Classifier ${node.classifier.key} not found for node ${node.id}`));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
this.validateProperties(node, classifier);
|
|
56
|
+
}
|
|
57
|
+
validateProperties(node, classifier) {
|
|
58
|
+
node.properties.forEach(actualProp => {
|
|
59
|
+
const propClassifier = this.registry.getNodeByMetaPointer(actualProp.property);
|
|
60
|
+
if (propClassifier === undefined) {
|
|
61
|
+
this.validationResult.issue(new GenericIssue(new JsonContext(null, ["nodes", "properties"]), `Property ${actualProp.property.key} not found for classifier ${classifier.id}`));
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=LionWebLanguageValidator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LionWebLanguageValidator.js","sourceRoot":"","sources":["../../src/validators/LionWebLanguageValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAqC,MAAM,eAAe,CAAA;AACrF,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAC7G,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AACrE,OAAO,EAAE,SAAS,EAAoB,MAAM,uBAAuB,CAAA;AAGnE;;GAEG;AACH,MAAM,OAAO,wBAAwB;IAGjC,uDAAuD;IAEvD,YAAY,gBAAkC,EAAU,QAA0B;QAA1B,aAAQ,GAAR,QAAQ,CAAkB;QAC9E,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAA;QACxC,IAAI,CAAC,YAAY,GAAG,SAAS,CAAA;IACjC,CAAC;IAED;;;;OAIG;I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CAAC,EAAE,EAAE,CAAC,CACvF,CAAA;YACL,CAAC;QACL,CAAC,CAAC,CAAA;IACN,CAAC;CACJ"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { LionWebJsonChunk, LionWebJsonMetaPointer, LionWebJsonNode, LionWebJsonUsedLanguage } from "@lionweb/json";
|
|
2
|
+
import { JsonContext, LionWebJsonChunkWrapper } from "@lionweb/json-utils";
|
|
3
|
+
import { ValidationResult } from "./generic/ValidationResult.js";
|
|
4
|
+
/**
|
|
5
|
+
* Assuming that the syntax is correct, check whether all LionWeb references are correct,
|
|
6
|
+
* as far as they do not need the used language definition.
|
|
7
|
+
*/
|
|
8
|
+
export declare class LionWebReferenceValidator {
|
|
9
|
+
validationResult: ValidationResult;
|
|
10
|
+
nodesIdMap: Map<string, LionWebJsonNode>;
|
|
11
|
+
constructor(validationResult: ValidationResult);
|
|
12
|
+
validateNodeIds(obj: LionWebJsonChunk, ctx: JsonContext): void;
|
|
13
|
+
validate(obj: LionWebJsonChunkWrapper): void;
|
|
14
|
+
/**
|
|
15
|
+
* Check whether the metapointer refers to a language defined in the usedLanguages of chunk.
|
|
16
|
+
* @param chunk
|
|
17
|
+
* @param metaPointer
|
|
18
|
+
* @param context
|
|
19
|
+
*/
|
|
20
|
+
validateLanguageReference(chunk: LionWebJsonChunkWrapper, metaPointer: LionWebJsonMetaPointer, context: JsonContext): void;
|
|
21
|
+
/**
|
|
22
|
+
* Check whether there are duplicate values in `strings`.
|
|
23
|
+
* @param strings
|
|
24
|
+
* @param context
|
|
25
|
+
*/
|
|
26
|
+
checkDuplicate(strings: string[], context: JsonContext): void;
|
|
27
|
+
/**
|
|
28
|
+
* Checks whether there are duplicate usedLanguages in `usedLanguages`.
|
|
29
|
+
* usedLanguages are considered equal when bith their `key` and `version` are identical.
|
|
30
|
+
* @param usedLanguages
|
|
31
|
+
* @param context
|
|
32
|
+
*/
|
|
33
|
+
checkDuplicateUsedLanguage(usedLanguages: LionWebJsonUsedLanguage[], context: JsonContext): void;
|
|
34
|
+
/**
|
|
35
|
+
* Checks whether the parent of node recursively points to `node` itself.
|
|
36
|
+
* @param node The noide being checked
|
|
37
|
+
* @param context The location in the JSON
|
|
38
|
+
*/
|
|
39
|
+
checkParentCircular(node: LionWebJsonNode, context: JsonContext): void;
|
|
40
|
+
validateExistsAsChild(context: JsonContext, parent: LionWebJsonNode | undefined, child: LionWebJsonNode): void;
|
|
41
|
+
validateChildrenHaveCorrectParent(node: LionWebJsonNode, context: JsonContext): void;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=LionWebReferenceValidator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LionWebReferenceValidator.d.ts","sourceRoot":"","sources":["../../src/validators/LionWebReferenceValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,gBAAgB,EAA0B,sBAAsB,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AACrJ,OAAO,EAAc,WAAW,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAStF,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAEhE;;;GAGG;AACH,qBAAa,yBAAyB;IAClC,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAqC;gBAEjE,gBAAgB,EAAE,gBAAgB;IAI9C,eAAe,CAAC,GAAG,EAAE,gBAAgB,EAAE,GAAG,EAAE,WAAW,GAAG,IAAI;IAW9D,QAAQ,CAAC,GAAG,EAAE,uBAAuB,GAAG,IAAI;IAqD5C;;;;;OAKG;IACH,yBAAyB,CAAC,KAAK,EAAE,uBAAuB,EAAE,WAAW,EAAE,sBAAsB,EAAE,OAAO,EAAE,WAAW;IAWnH;;;;OAIG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,WAAW;IActD;;;;;OAKG;IACH,0BAA0B,CAAC,aAAa,EAAE,uBAAuB,EAAE,EAAE,OAAO,EAAE,WAAW;IAiBzF;;;;OAIG;IACH,mBAAmB,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,WAAW;IAsB/D,qBAAqB,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,eAAe,GAAG,SAAS,EAAE,KAAK,EAAE,eAAe;IAevG,iCAAiC,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,WAAW;CAmChF"}
|
package/{src/validators/LionWebReferenceValidator.ts → dist/validators/LionWebReferenceValidator.js}
RENAMED
|
@@ -1,218 +1,195 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
Duplicates_Issue,
|
|
5
|
-
Reference_ChildMissingInParent_Issue,
|
|
6
|
-
Reference_CirculairParent_Issue,
|
|
7
|
-
Reference_DuplicateNodeId_Issue,
|
|
8
|
-
Reference_LanguageUnknown_Issue,
|
|
9
|
-
Reference_ParentMissingInChild_Issue
|
|
10
|
-
} from "../issues/ReferenceIssues.js"
|
|
11
|
-
import { ValidationResult } from "./generic/ValidationResult.js"
|
|
12
|
-
|
|
1
|
+
import { ChunkUtils, JsonContext } from "@lionweb/json-utils";
|
|
2
|
+
import { Duplicates_Issue, Reference_ChildMissingInParent_Issue, Reference_CirculairParent_Issue, Reference_DuplicateNodeId_Issue, Reference_LanguageUnknown_Issue, Reference_ParentMissingInChild_Issue } from "../issues/ReferenceIssues.js";
|
|
13
3
|
/**
|
|
14
4
|
* Assuming that the syntax is correct, check whether all LionWeb references are correct,
|
|
15
5
|
* as far as they do not need the used language definition.
|
|
16
6
|
*/
|
|
17
7
|
export class LionWebReferenceValidator {
|
|
18
|
-
validationResult
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
constructor(validationResult: ValidationResult) {
|
|
22
|
-
this.validationResult = validationResult
|
|
8
|
+
constructor(validationResult) {
|
|
9
|
+
this.nodesIdMap = new Map();
|
|
10
|
+
this.validationResult = validationResult;
|
|
23
11
|
}
|
|
24
|
-
|
|
25
|
-
validateNodeIds(obj: LionWebJsonChunk, ctx: JsonContext): void {
|
|
12
|
+
validateNodeIds(obj, ctx) {
|
|
26
13
|
// put all nodes in a map, validate that there are no two nodes with the same id.
|
|
27
14
|
obj.nodes.forEach((node, index) => {
|
|
28
15
|
// this.validationResult.check(this.nodesIdMap.get(node.id) === undefined, `Node number ${index} has duplicate id "${node.id}"`);
|
|
29
16
|
if (!(this.nodesIdMap.get(node.id) === undefined)) {
|
|
30
|
-
this.validationResult.issue(new Reference_DuplicateNodeId_Issue(ctx.concat("nodes", index), node.id))
|
|
17
|
+
this.validationResult.issue(new Reference_DuplicateNodeId_Issue(ctx.concat("nodes", index), node.id));
|
|
31
18
|
}
|
|
32
|
-
this.nodesIdMap.set(node.id, node)
|
|
33
|
-
})
|
|
19
|
+
this.nodesIdMap.set(node.id, node);
|
|
20
|
+
});
|
|
34
21
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
this.
|
|
39
|
-
this.validateNodeIds(obj.jsonChunk, rootCtx)
|
|
22
|
+
validate(obj) {
|
|
23
|
+
const rootCtx = new JsonContext(null, ["$"]);
|
|
24
|
+
this.checkDuplicateUsedLanguage(obj.jsonChunk.languages, rootCtx);
|
|
25
|
+
this.validateNodeIds(obj.jsonChunk, rootCtx);
|
|
40
26
|
obj.jsonChunk.nodes.forEach((node, nodeIndex) => {
|
|
41
|
-
const context = rootCtx.concat(`node`, nodeIndex)
|
|
42
|
-
const parentNode = node.parent
|
|
27
|
+
const context = rootCtx.concat(`node`, nodeIndex);
|
|
28
|
+
const parentNode = node.parent;
|
|
43
29
|
if (parentNode !== null) {
|
|
44
|
-
this.validateExistsAsChild(context, this.nodesIdMap.get(parentNode), node)
|
|
30
|
+
this.validateExistsAsChild(context, this.nodesIdMap.get(parentNode), node);
|
|
45
31
|
}
|
|
46
|
-
this.validateLanguageReference(obj, node.classifier, context)
|
|
47
|
-
this.checkParentCircular(node, context)
|
|
48
|
-
this.checkDuplicate(node.annotations, rootCtx.concat("node", nodeIndex, "annotations"))
|
|
49
|
-
this.validateChildrenHaveCorrectParent(node, rootCtx.concat("node", nodeIndex))
|
|
32
|
+
this.validateLanguageReference(obj, node.classifier, context);
|
|
33
|
+
this.checkParentCircular(node, context);
|
|
34
|
+
this.checkDuplicate(node.annotations, rootCtx.concat("node", nodeIndex, "annotations"));
|
|
35
|
+
this.validateChildrenHaveCorrectParent(node, rootCtx.concat("node", nodeIndex));
|
|
50
36
|
node.properties.forEach((prop, propertyIndex) => {
|
|
51
|
-
this.validateLanguageReference(obj, prop.property, rootCtx.concat("node", nodeIndex, "property", propertyIndex))
|
|
52
|
-
})
|
|
37
|
+
this.validateLanguageReference(obj, prop.property, rootCtx.concat("node", nodeIndex, "property", propertyIndex));
|
|
38
|
+
});
|
|
53
39
|
node.containments.forEach((containment, childIndex) => {
|
|
54
|
-
this.validateLanguageReference(obj, containment.containment, rootCtx.concat("node", nodeIndex, "containments", childIndex))
|
|
55
|
-
this.checkDuplicate(containment.children, rootCtx.concat("node", nodeIndex, "containments", childIndex))
|
|
40
|
+
this.validateLanguageReference(obj, containment.containment, rootCtx.concat("node", nodeIndex, "containments", childIndex));
|
|
41
|
+
this.checkDuplicate(containment.children, rootCtx.concat("node", nodeIndex, "containments", childIndex));
|
|
56
42
|
containment.children.forEach(childId => {
|
|
57
|
-
const childNode = this.nodesIdMap.get(childId)
|
|
43
|
+
const childNode = this.nodesIdMap.get(childId);
|
|
58
44
|
if (childNode !== undefined) {
|
|
59
45
|
if (childNode.parent !== null && childNode.parent !== undefined && childNode.parent !== node.id) {
|
|
60
|
-
this.validationResult.issue(new Reference_ParentMissingInChild_Issue(context, node, childNode))
|
|
46
|
+
this.validationResult.issue(new Reference_ParentMissingInChild_Issue(context, node, childNode));
|
|
61
47
|
// TODO this.validationResult.error(`Child "${childId}" with parent "${childNode.parent}" is defined as child in node "${node.id}"`);
|
|
62
48
|
}
|
|
63
49
|
if (childNode.parent === null || childNode.parent === undefined) {
|
|
64
50
|
// TODO this.validationResult.error(`Child "${childId}" of node "${node.id}" has different parent "${childNode.parent}"`);
|
|
65
51
|
}
|
|
66
52
|
}
|
|
67
|
-
})
|
|
68
|
-
})
|
|
53
|
+
});
|
|
54
|
+
});
|
|
69
55
|
node.annotations.forEach(annotationId => {
|
|
70
|
-
const annotation = this.nodesIdMap.get(annotationId)
|
|
56
|
+
const annotation = this.nodesIdMap.get(annotationId);
|
|
71
57
|
if (annotation !== undefined) {
|
|
72
58
|
if (annotation.parent !== null && annotation.parent !== undefined && annotation.parent !== node.id) {
|
|
73
|
-
this.validationResult.issue(new Reference_ParentMissingInChild_Issue(context, node, annotation))
|
|
59
|
+
this.validationResult.issue(new Reference_ParentMissingInChild_Issue(context, node, annotation));
|
|
74
60
|
// TODO this.validationResult.error(`Child "${annotationId}" with parent "${childNode.parent}" is defined as child in node "${node.id}"`);
|
|
75
61
|
}
|
|
76
62
|
if (annotation.parent === null || annotation.parent === undefined) {
|
|
77
63
|
// TODO this.validationResult.error(`Child "${annotationId}" of node "${node.id}" has different parent "${childNode.parent}"`);
|
|
78
64
|
}
|
|
79
65
|
}
|
|
80
|
-
})
|
|
66
|
+
});
|
|
81
67
|
node.references.forEach((ref, refIndex) => {
|
|
82
|
-
this.validateLanguageReference(obj, ref.reference, rootCtx.concat("node", nodeIndex, "references", refIndex))
|
|
68
|
+
this.validateLanguageReference(obj, ref.reference, rootCtx.concat("node", nodeIndex, "references", refIndex));
|
|
83
69
|
// TODO Check for duplicate targets?
|
|
84
70
|
// If so, what to check because there can be either or both a `resolveInfo` and a `reference`
|
|
85
|
-
})
|
|
86
|
-
})
|
|
71
|
+
});
|
|
72
|
+
});
|
|
87
73
|
}
|
|
88
|
-
|
|
89
74
|
/**
|
|
90
75
|
* Check whether the metapointer refers to a language defined in the usedLanguages of chunk.
|
|
91
76
|
* @param chunk
|
|
92
77
|
* @param metaPointer
|
|
93
78
|
* @param context
|
|
94
79
|
*/
|
|
95
|
-
validateLanguageReference(chunk
|
|
96
|
-
const lang = ChunkUtils.findLwUsedLanguageWithVersion(chunk.jsonChunk, metaPointer.language, metaPointer.version)
|
|
80
|
+
validateLanguageReference(chunk, metaPointer, context) {
|
|
81
|
+
const lang = ChunkUtils.findLwUsedLanguageWithVersion(chunk.jsonChunk, metaPointer.language, metaPointer.version);
|
|
97
82
|
if (lang === undefined || lang === null) {
|
|
98
|
-
this.validationResult.issue(new Reference_LanguageUnknown_Issue(context, metaPointer))
|
|
99
|
-
}
|
|
83
|
+
this.validationResult.issue(new Reference_LanguageUnknown_Issue(context, metaPointer));
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
100
86
|
if (lang.version !== metaPointer.version) {
|
|
101
|
-
this.validationResult.issue(new Reference_LanguageUnknown_Issue(context, metaPointer))
|
|
87
|
+
this.validationResult.issue(new Reference_LanguageUnknown_Issue(context, metaPointer));
|
|
102
88
|
}
|
|
103
89
|
}
|
|
104
90
|
}
|
|
105
|
-
|
|
106
91
|
/**
|
|
107
92
|
* Check whether there are duplicate values in `strings`.
|
|
108
93
|
* @param strings
|
|
109
94
|
* @param context
|
|
110
95
|
*/
|
|
111
|
-
checkDuplicate(strings
|
|
96
|
+
checkDuplicate(strings, context) {
|
|
112
97
|
if (strings === null || strings === undefined) {
|
|
113
|
-
return
|
|
98
|
+
return;
|
|
114
99
|
}
|
|
115
|
-
const alreadySeen
|
|
100
|
+
const alreadySeen = {};
|
|
116
101
|
strings.forEach(str => {
|
|
117
102
|
if (alreadySeen[str]) {
|
|
118
|
-
this.validationResult.issue(new Duplicates_Issue(context, str))
|
|
119
|
-
}
|
|
120
|
-
|
|
103
|
+
this.validationResult.issue(new Duplicates_Issue(context, str));
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
alreadySeen[str] = true;
|
|
121
107
|
}
|
|
122
|
-
})
|
|
108
|
+
});
|
|
123
109
|
}
|
|
124
|
-
|
|
125
110
|
/**
|
|
126
111
|
* Checks whether there are duplicate usedLanguages in `usedLanguages`.
|
|
127
112
|
* usedLanguages are considered equal when bith their `key` and `version` are identical.
|
|
128
113
|
* @param usedLanguages
|
|
129
114
|
* @param context
|
|
130
115
|
*/
|
|
131
|
-
checkDuplicateUsedLanguage(usedLanguages
|
|
116
|
+
checkDuplicateUsedLanguage(usedLanguages, context) {
|
|
132
117
|
if (usedLanguages === null || usedLanguages === undefined) {
|
|
133
|
-
return
|
|
118
|
+
return;
|
|
134
119
|
}
|
|
135
|
-
const alreadySeen = new Map
|
|
120
|
+
const alreadySeen = new Map();
|
|
136
121
|
usedLanguages.forEach((usedLanguage, index) => {
|
|
137
|
-
const seenKeys = alreadySeen.get(usedLanguage.key)
|
|
122
|
+
const seenKeys = alreadySeen.get(usedLanguage.key);
|
|
138
123
|
if (seenKeys !== null && seenKeys !== undefined) {
|
|
139
124
|
if (seenKeys.includes(usedLanguage.version)) {
|
|
140
|
-
this.validationResult.issue(new Duplicates_Issue(context.concat("language", index, "version"), usedLanguage.version))
|
|
125
|
+
this.validationResult.issue(new Duplicates_Issue(context.concat("language", index, "version"), usedLanguage.version));
|
|
141
126
|
}
|
|
142
|
-
} else {
|
|
143
|
-
alreadySeen.set(usedLanguage.key, [usedLanguage.version])
|
|
144
127
|
}
|
|
145
|
-
|
|
128
|
+
else {
|
|
129
|
+
alreadySeen.set(usedLanguage.key, [usedLanguage.version]);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
146
132
|
}
|
|
147
|
-
|
|
148
133
|
/**
|
|
149
134
|
* Checks whether the parent of node recursively points to `node` itself.
|
|
150
135
|
* @param node The noide being checked
|
|
151
136
|
* @param context The location in the JSON
|
|
152
137
|
*/
|
|
153
|
-
checkParentCircular(node
|
|
138
|
+
checkParentCircular(node, context) {
|
|
154
139
|
if (node === null || node === undefined) {
|
|
155
|
-
return
|
|
140
|
+
return;
|
|
156
141
|
}
|
|
157
142
|
if (node.parent === null || node.parent === undefined) {
|
|
158
|
-
return
|
|
143
|
+
return;
|
|
159
144
|
}
|
|
160
|
-
let current
|
|
161
|
-
const seenParents = [node.id]
|
|
145
|
+
let current = node;
|
|
146
|
+
const seenParents = [node.id];
|
|
162
147
|
while (current !== null && current !== undefined && current.parent !== null && current.parent !== undefined) {
|
|
163
|
-
const nextParent = current.parent
|
|
148
|
+
const nextParent = current.parent;
|
|
164
149
|
if (nextParent !== null && nextParent !== undefined && seenParents.includes(nextParent)) {
|
|
165
|
-
this.validationResult.issue(
|
|
166
|
-
|
|
167
|
-
)
|
|
168
|
-
return
|
|
150
|
+
this.validationResult.issue(new Reference_CirculairParent_Issue(context.concat("???"), this.nodesIdMap.get(nextParent), seenParents));
|
|
151
|
+
return;
|
|
169
152
|
}
|
|
170
|
-
seenParents.push(nextParent)
|
|
171
|
-
current = this.nodesIdMap.get(nextParent)
|
|
153
|
+
seenParents.push(nextParent);
|
|
154
|
+
current = this.nodesIdMap.get(nextParent);
|
|
172
155
|
}
|
|
173
156
|
}
|
|
174
|
-
|
|
175
|
-
validateExistsAsChild(context: JsonContext, parent: LionWebJsonNode | undefined, child: LionWebJsonNode) {
|
|
157
|
+
validateExistsAsChild(context, parent, child) {
|
|
176
158
|
if (parent === undefined || parent === null) {
|
|
177
|
-
return
|
|
159
|
+
return;
|
|
178
160
|
}
|
|
179
161
|
for (const containment of parent.containments) {
|
|
180
162
|
if (containment.children.includes(child.id)) {
|
|
181
|
-
return
|
|
163
|
+
return;
|
|
182
164
|
}
|
|
183
165
|
}
|
|
184
166
|
if (parent.annotations.includes(child.id)) {
|
|
185
|
-
return
|
|
167
|
+
return;
|
|
186
168
|
}
|
|
187
|
-
this.validationResult.issue(new Reference_ChildMissingInParent_Issue(context, child, parent))
|
|
169
|
+
this.validationResult.issue(new Reference_ChildMissingInParent_Issue(context, child, parent));
|
|
188
170
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
const childNode = this.nodesIdMap.get(childId)
|
|
171
|
+
validateChildrenHaveCorrectParent(node, context) {
|
|
172
|
+
node.containments.forEach((child) => {
|
|
173
|
+
child.children.forEach((childId, index) => {
|
|
174
|
+
const childNode = this.nodesIdMap.get(childId);
|
|
194
175
|
if (childNode !== undefined) {
|
|
195
176
|
if (childNode.parent !== node.id) {
|
|
196
177
|
// TODO Check that this is already tested from the child in vaidateExistsAsChild().
|
|
197
178
|
}
|
|
198
179
|
if (childNode.parent === null || childNode.parent === undefined) {
|
|
199
|
-
this.validationResult.issue(
|
|
200
|
-
new Reference_ParentMissingInChild_Issue(context.concat("child", "containment", "key", index), node, childNode),
|
|
201
|
-
)
|
|
180
|
+
this.validationResult.issue(new Reference_ParentMissingInChild_Issue(context.concat("child", "containment", "key", index), node, childNode));
|
|
202
181
|
}
|
|
203
182
|
}
|
|
204
|
-
})
|
|
205
|
-
})
|
|
206
|
-
node.annotations.forEach((annotationId
|
|
207
|
-
const childNode = this.nodesIdMap.get(annotationId)
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
node.annotations.forEach((annotationId, annotationIndex) => {
|
|
186
|
+
const childNode = this.nodesIdMap.get(annotationId);
|
|
208
187
|
if (childNode !== undefined) {
|
|
209
188
|
if (childNode.parent === null || childNode.parent === undefined) {
|
|
210
|
-
this.validationResult.issue(
|
|
211
|
-
new Reference_ParentMissingInChild_Issue(context.concat("annotations", annotationIndex), node, childNode),
|
|
212
|
-
)
|
|
189
|
+
this.validationResult.issue(new Reference_ParentMissingInChild_Issue(context.concat("annotations", annotationIndex), node, childNode));
|
|
213
190
|
}
|
|
214
191
|
}
|
|
215
|
-
})
|
|
192
|
+
});
|
|
216
193
|
// for (const childId of NodeUtils.allChildren(node)) {
|
|
217
194
|
// const childNode = this.nodesIdMap.get(childId);
|
|
218
195
|
// if (childNode !== undefined) {
|
|
@@ -223,3 +200,4 @@ export class LionWebReferenceValidator {
|
|
|
223
200
|
// }
|
|
224
201
|
}
|
|
225
202
|
}
|
|
203
|
+
//# sourceMappingURL=LionWebReferenceValidator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LionWebReferenceValidator.js","sourceRoot":"","sources":["../../src/validators/LionWebReferenceValidator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,WAAW,EAA2B,MAAM,qBAAqB,CAAA;AACtF,OAAO,EACH,gBAAgB,EAChB,oCAAoC,EACpC,+BAA+B,EAC/B,+BAA+B,EAC/B,+BAA+B,EAC/B,oCAAoC,EACvC,MAAM,8BAA8B,CAAA;AAGrC;;;GAGG;AACH,MAAM,OAAO,yBAAyB;IAIlC,YAAY,gBAAkC;QAF9C,eAAU,GAAiC,IAAI,GAAG,EAA2B,CAAA;QAGzE,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAA;IAC5C,CAAC;IAED,eAAe,CAAC,GAAqB,EAAE,GAAgB;QACnD,iFAAiF;QACjF,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YAC9B,iIAAiI;YACjI,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,SAAS,CAAC,EAAE,CAAC;gBAChD,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,IAAI,+BAA+B,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;YACzG,CAAC;YACD,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;QACtC,CAAC,CAAC,CAAA;IACN,CAAC;IAED,QAAQ,CAAC,GAA4B;QACjC,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;QAC5C,IAAI,CAAC,0BAA0B,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;Q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AAE,EAAE;YAC1E,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;YACnD,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;gBAC1B,IAAI,SAAS,CAAC,MAAM,KAAK,IAAI,IAAI,SAAS,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;oBAC9D,IAAI,CAAC,gBAAgB,CAAC,KAAK,CACvB,IAAI,oCAAoC,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,eAAe,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,CAC5G,CAAA;gBACL,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAA;QACF,uDAAuD;QACvD,sDAAsD;QACtD,qCAAqC;QACrC,8CAA8C;QAC9C,iJAAiJ;QACjJ,YAAY;QACZ,QAAQ;QACR,IAAI;IACR,CAAC;CACJ"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SyntaxValidator } from "./generic/SyntaxValidator.js";
|
|
2
|
+
import { ValidationResult } from "./generic/ValidationResult.js";
|
|
3
|
+
/**
|
|
4
|
+
* LionWebSyntaxValidator can check whether objects are structurally LionWeb objects.
|
|
5
|
+
*/
|
|
6
|
+
export declare class LionWebSyntaxValidator extends SyntaxValidator {
|
|
7
|
+
constructor(validationResult: ValidationResult);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=LionWebSyntaxValidator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LionWebSyntaxValidator.d.ts","sourceRoot":"","sources":["../../src/validators/LionWebSyntaxValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAGhE;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,eAAe;gBAE3C,gBAAgB,EAAE,gBAAgB;CAGjD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SyntaxValidator } from "./generic/SyntaxValidator.js";
|
|
2
|
+
import { LionWebSchema } from "./LionWebChunkDefinitions.js";
|
|
3
|
+
/**
|
|
4
|
+
* LionWebSyntaxValidator can check whether objects are structurally LionWeb objects.
|
|
5
|
+
*/
|
|
6
|
+
export class LionWebSyntaxValidator extends SyntaxValidator {
|
|
7
|
+
constructor(validationResult) {
|
|
8
|
+
super(validationResult, LionWebSchema);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=LionWebSyntaxValidator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LionWebSyntaxValidator.js","sourceRoot":"","sources":["../../src/validators/LionWebSyntaxValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAE5D;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,eAAe;IAEvD,YAAY,gBAAkC;QAC1C,KAAK,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAA;IAC1C,CAAC;CACJ"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { LanguageRegistry } from "../languages/index.js";
|
|
2
|
+
import { ValidationResult } from "./generic/ValidationResult.js";
|
|
3
|
+
import { LionWebReferenceValidator } from "./LionWebReferenceValidator.js";
|
|
4
|
+
import { LionWebSyntaxValidator } from "./LionWebSyntaxValidator.js";
|
|
5
|
+
/**
|
|
6
|
+
* Combined validator that calls all available validators.
|
|
7
|
+
* Will stop when one validator fails.
|
|
8
|
+
*/
|
|
9
|
+
export declare class LionWebValidator {
|
|
10
|
+
private registry;
|
|
11
|
+
object: unknown;
|
|
12
|
+
chunk: unknown;
|
|
13
|
+
validationResult: ValidationResult;
|
|
14
|
+
syntaxValidator: LionWebSyntaxValidator;
|
|
15
|
+
referenceValidator: LionWebReferenceValidator;
|
|
16
|
+
syntaxCorrect: boolean;
|
|
17
|
+
referencesCorrect: boolean;
|
|
18
|
+
constructor(json: unknown, registry: LanguageRegistry);
|
|
19
|
+
validateAll(): void;
|
|
20
|
+
validateSyntax(): void;
|
|
21
|
+
validateReferences(): void;
|
|
22
|
+
validateForLanguage(): void;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=LionWebValidator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LionWebValidator.d.ts","sourceRoot":"","sources":["../../src/validators/LionWebValidator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAEhE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAA;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAEpE;;;GAGG;AACH,qBAAa,gBAAgB;IAUE,OAAO,CAAC,QAAQ;IAT3C,MAAM,EAAE,OAAO,CAAA;IAEf,KAAK,EAAE,OAAO,CAAA;IACd,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,eAAe,EAAE,sBAAsB,CAAA;IACvC,kBAAkB,EAAE,yBAAyB,CAAA;IAC7C,aAAa,EAAE,OAAO,CAAQ;IAC9B,iBAAiB,EAAE,OAAO,CAAQ;gBAEtB,IAAI,EAAE,OAAO,EAAU,QAAQ,EAAE,gBAAgB;IAO7D,WAAW;IAMX,cAAc;IAQd,kBAAkB,IAAI,IAAI;IAU1B,mBAAmB,IAAI,IAAI;CAiB9B"}
|
|
@@ -1,71 +1,55 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { LionWebReferenceValidator } from "./LionWebReferenceValidator.js"
|
|
7
|
-
import { LionWebSyntaxValidator } from "./LionWebSyntaxValidator.js"
|
|
8
|
-
|
|
1
|
+
import { LionWebJsonChunkWrapper } from "@lionweb/json-utils";
|
|
2
|
+
import { ValidationResult } from "./generic/ValidationResult.js";
|
|
3
|
+
import { LionWebLanguageReferenceValidator } from "./LionWebLanguageReferenceValidator.js";
|
|
4
|
+
import { LionWebReferenceValidator } from "./LionWebReferenceValidator.js";
|
|
5
|
+
import { LionWebSyntaxValidator } from "./LionWebSyntaxValidator.js";
|
|
9
6
|
/**
|
|
10
7
|
* Combined validator that calls all available validators.
|
|
11
8
|
* Will stop when one validator fails.
|
|
12
9
|
*/
|
|
13
10
|
export class LionWebValidator {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
constructor(json: unknown, private registry: LanguageRegistry) {
|
|
24
|
-
this.object = json
|
|
25
|
-
this.validationResult = new ValidationResult()
|
|
26
|
-
this.syntaxValidator = new LionWebSyntaxValidator(this.validationResult)
|
|
27
|
-
this.referenceValidator = new LionWebReferenceValidator(this.validationResult)
|
|
11
|
+
constructor(json, registry) {
|
|
12
|
+
this.registry = registry;
|
|
13
|
+
this.syntaxCorrect = false;
|
|
14
|
+
this.referencesCorrect = false;
|
|
15
|
+
this.object = json;
|
|
16
|
+
this.validationResult = new ValidationResult();
|
|
17
|
+
this.syntaxValidator = new LionWebSyntaxValidator(this.validationResult);
|
|
18
|
+
this.referenceValidator = new LionWebReferenceValidator(this.validationResult);
|
|
28
19
|
}
|
|
29
|
-
|
|
30
20
|
validateAll() {
|
|
31
|
-
this.validateSyntax()
|
|
32
|
-
this.validateReferences()
|
|
33
|
-
this.validateForLanguage()
|
|
21
|
+
this.validateSyntax();
|
|
22
|
+
this.validateReferences();
|
|
23
|
+
this.validateForLanguage();
|
|
34
24
|
}
|
|
35
|
-
|
|
36
25
|
validateSyntax() {
|
|
37
|
-
this.syntaxValidator.validate(this.object, "LionWebJsonChunk")
|
|
38
|
-
this.syntaxCorrect = !this.validationResult.hasErrors()
|
|
26
|
+
this.syntaxValidator.validate(this.object, "LionWebJsonChunk");
|
|
27
|
+
this.syntaxCorrect = !this.validationResult.hasErrors();
|
|
39
28
|
if (this.syntaxCorrect) {
|
|
40
|
-
this.chunk = new LionWebJsonChunkWrapper(this.object
|
|
29
|
+
this.chunk = new LionWebJsonChunkWrapper(this.object);
|
|
41
30
|
}
|
|
42
31
|
}
|
|
43
|
-
|
|
44
|
-
validateReferences(): void {
|
|
32
|
+
validateReferences() {
|
|
45
33
|
if (!this.syntaxCorrect) {
|
|
46
34
|
// console.log("validateReferences not executed because there are syntax errors.")
|
|
47
|
-
return
|
|
35
|
+
return;
|
|
48
36
|
}
|
|
49
37
|
// when syntax is correct we know the chunk is actually a chunk!
|
|
50
|
-
this.referenceValidator.validate(this.chunk
|
|
51
|
-
this.referencesCorrect = !this.validationResult.hasErrors()
|
|
38
|
+
this.referenceValidator.validate(this.chunk);
|
|
39
|
+
this.referencesCorrect = !this.validationResult.hasErrors();
|
|
52
40
|
}
|
|
53
|
-
|
|
54
|
-
validateForLanguage(): void {
|
|
41
|
+
validateForLanguage() {
|
|
55
42
|
if (!this.syntaxCorrect) {
|
|
56
43
|
// console.log("validateForLanguage not executed because there are syntax errors.")
|
|
57
|
-
return
|
|
44
|
+
return;
|
|
58
45
|
}
|
|
59
46
|
if (!this.referencesCorrect) {
|
|
60
47
|
// console.log("validateForLanguage not executed because there are reference errors.")
|
|
61
|
-
return
|
|
48
|
+
return;
|
|
62
49
|
}
|
|
63
|
-
const languageReferenceValidator = new LionWebLanguageReferenceValidator(this.validationResult, this.registry)
|
|
50
|
+
const languageReferenceValidator = new LionWebLanguageReferenceValidator(this.validationResult, this.registry);
|
|
64
51
|
// when syntax is correct we know the chunk is actually a chunk!
|
|
65
|
-
languageReferenceValidator.validate(this.chunk
|
|
52
|
+
languageReferenceValidator.validate(this.chunk);
|
|
66
53
|
}
|
|
67
|
-
|
|
68
|
-
// setLanguage(json: LionwebLanguageDefinition) {
|
|
69
|
-
// this.language = json;
|
|
70
|
-
// }
|
|
71
54
|
}
|
|
55
|
+
//# sourceMappingURL=LionWebValidator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LionWebValidator.js","sourceRoot":"","sources":["../../src/validators/LionWebValidator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAE7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAChE,OAAO,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAA;AAC1F,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAA;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAEpE;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IAUzB,YAAY,IAAa,EAAU,QAA0B;QAA1B,aAAQ,GAAR,QAAQ,CAAkB;QAH7D,kBAAa,GAAY,KAAK,CAAA;QAC9B,sBAAiB,GAAY,KAAK,CAAA;QAG9B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;QAClB,IAAI,CAAC,gBAAgB,GAAG,IAAI,gBAAgB,EAAE,CAAA;QAC9C,IAAI,CAAC,eAAe,GAAG,IAAI,sBAAsB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;QACxE,IAAI,CAAC,kBAAkB,GAAG,IAAI,yBAAyB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;IAClF,CAAC;IAED,WAAW;QACP,IAAI,CAAC,cAAc,EAAE,CAAA;QACrB,IAAI,CAAC,kBAAkB,EAAE,CAAA;QACzB,IAAI,CAAC,mBAAmB,EAAE,CAAA;IAC9B,CAAC;IAED,cAAc;QACV,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;QAC9D,IAAI,CAAC,aAAa,GAAG,CAAC,IAAI,CAAC,gBAAg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