@lionweb/validation 0.6.13-beta.7 → 0.7.0-alpha.10
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/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -3
- package/dist/index.js.map +1 -1
- package/dist/issues/LanguageIssues.d.ts +4 -4
- package/dist/issues/LanguageIssues.d.ts.map +1 -1
- package/dist/issues/LanguageIssues.js +1 -1
- package/dist/issues/LanguageIssues.js.map +1 -1
- package/dist/issues/ReferenceIssues.d.ts +6 -6
- package/dist/issues/ReferenceIssues.d.ts.map +1 -1
- package/dist/issues/ReferenceIssues.js +3 -3
- package/dist/issues/ReferenceIssues.js.map +1 -1
- package/dist/issues/SyntaxIssues.d.ts +1 -1
- package/dist/issues/SyntaxIssues.d.ts.map +1 -1
- package/dist/issues/ValidationIssue.d.ts +4 -4
- package/dist/issues/ValidationIssue.d.ts.map +1 -1
- package/dist/issues/ValidationIssue.js +1 -1
- package/dist/issues/ValidationIssue.js.map +1 -1
- package/dist/issues/index.d.ts +0 -1
- package/dist/issues/index.d.ts.map +1 -1
- package/dist/issues/index.js +0 -1
- package/dist/issues/index.js.map +1 -1
- package/dist/languages/CompositeLionWebLanguageWrapper.d.ts +1 -1
- package/dist/languages/CompositeLionWebLanguageWrapper.d.ts.map +1 -1
- package/dist/languages/LanguageRegistry.d.ts +1 -1
- package/dist/languages/LanguageRegistry.d.ts.map +1 -1
- package/dist/languages/LanguageUtils.d.ts +1 -1
- package/dist/languages/LanguageUtils.d.ts.map +1 -1
- package/dist/languages/LanguageUtils.js +5 -5
- package/dist/languages/LanguageUtils.js.map +1 -1
- package/dist/languages/LionWebLanguageWrapper.d.ts +3 -3
- package/dist/languages/LionWebLanguageWrapper.d.ts.map +1 -1
- package/dist/languages/LionWebLanguageWrapper.js +2 -2
- package/dist/languages/LionWebLanguageWrapper.js.map +1 -1
- package/dist/languages/MetaPointerMap.d.ts +2 -2
- package/dist/languages/MetaPointerMap.d.ts.map +1 -1
- package/dist/languages/MetaPointerMap.js +1 -1
- package/dist/languages/MetaPointerMap.js.map +1 -1
- package/dist/runners/FileUtils.d.ts.map +1 -1
- package/dist/runners/FileUtils.js +1 -1
- package/dist/runners/FileUtils.js.map +1 -1
- package/dist/runners/RunCheckFolderWithLanguage.js.map +1 -1
- package/dist/runners/RunLioncoreDiff.js +1 -1
- package/dist/runners/RunLioncoreDiff.js.map +1 -1
- package/dist/runners/Utils.js +2 -2
- package/dist/runners/Utils.js.map +1 -1
- package/dist/validators/LionWebChunkDefinitions.d.ts +4 -4
- package/dist/validators/LionWebChunkDefinitions.d.ts.map +1 -1
- package/dist/validators/LionWebChunkDefinitions.js +82 -79
- package/dist/validators/LionWebChunkDefinitions.js.map +1 -1
- package/dist/validators/LionWebLanguageReferenceValidator.d.ts +2 -4
- package/dist/validators/LionWebLanguageReferenceValidator.d.ts.map +1 -1
- package/dist/validators/LionWebLanguageReferenceValidator.js +2 -6
- package/dist/validators/LionWebLanguageReferenceValidator.js.map +1 -1
- package/dist/validators/LionWebLanguageValidator.d.ts +2 -3
- package/dist/validators/LionWebLanguageValidator.d.ts.map +1 -1
- package/dist/validators/LionWebLanguageValidator.js +2 -4
- package/dist/validators/LionWebLanguageValidator.js.map +1 -1
- package/dist/validators/LionWebReferenceValidator.d.ts +3 -4
- package/dist/validators/LionWebReferenceValidator.d.ts.map +1 -1
- package/dist/validators/LionWebReferenceValidator.js +2 -3
- package/dist/validators/LionWebReferenceValidator.js.map +1 -1
- package/dist/validators/LionWebSyntaxValidator.d.ts.map +1 -1
- package/dist/validators/LionWebSyntaxValidator.js +2 -2
- package/dist/validators/LionWebSyntaxValidator.js.map +1 -1
- package/dist/validators/LionWebValidator.d.ts +1 -1
- package/dist/validators/LionWebValidator.d.ts.map +1 -1
- package/dist/validators/LionWebValidator.js +3 -3
- package/dist/validators/LionWebValidator.js.map +1 -1
- package/dist/validators/ValidationFunctions.d.ts +6 -2
- package/dist/validators/ValidationFunctions.d.ts.map +1 -1
- package/dist/validators/ValidationFunctions.js +4 -8
- package/dist/validators/ValidationFunctions.js.map +1 -1
- package/dist/validators/generic/SyntaxValidator.d.ts +11 -11
- package/dist/validators/generic/SyntaxValidator.d.ts.map +1 -1
- package/dist/validators/generic/SyntaxValidator.js +62 -64
- package/dist/validators/generic/SyntaxValidator.js.map +1 -1
- package/dist/validators/generic/index.d.ts +1 -2
- package/dist/validators/generic/index.d.ts.map +1 -1
- package/dist/validators/generic/index.js +1 -2
- package/dist/validators/generic/index.js.map +1 -1
- 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 +0 -1
- package/dist/validators/index.d.ts.map +1 -1
- package/dist/validators/index.js +0 -1
- package/dist/validators/index.js.map +1 -1
- package/package.json +10 -4
- package/src/index.ts +0 -3
- package/src/issues/LanguageIssues.ts +12 -14
- package/src/issues/ReferenceIssues.ts +9 -9
- package/src/issues/SyntaxIssues.ts +5 -5
- package/src/issues/ValidationIssue.ts +10 -7
- package/src/issues/index.ts +0 -1
- package/src/languages/CompositeLionWebLanguageWrapper.ts +1 -1
- package/src/languages/LanguageRegistry.ts +1 -1
- package/src/languages/LanguageUtils.ts +6 -6
- package/src/languages/LionWebLanguageWrapper.ts +5 -9
- package/src/languages/MetaPointerMap.ts +7 -6
- package/src/runners/FileUtils.ts +1 -1
- package/src/runners/RunCheckFolderWithLanguage.ts +1 -1
- package/src/runners/RunLioncoreDiff.ts +2 -2
- package/src/runners/Utils.ts +2 -2
- package/src/validators/LionWebChunkDefinitions.ts +83 -85
- package/src/validators/LionWebLanguageReferenceValidator.ts +18 -20
- package/src/validators/LionWebLanguageValidator.ts +2 -4
- package/src/validators/LionWebReferenceValidator.ts +6 -14
- package/src/validators/LionWebSyntaxValidator.ts +2 -2
- package/src/validators/LionWebValidator.ts +4 -4
- package/src/validators/ValidationFunctions.ts +6 -6
- package/src/validators/generic/SyntaxValidator.ts +70 -69
- package/src/validators/generic/index.ts +1 -2
- package/src/validators/generic/schema/DefinitionSchema.ts +52 -0
- package/src/validators/generic/schema/ValidationTypes.ts +134 -0
- package/src/validators/generic/schema/index.ts +2 -0
- package/src/validators/index.ts +0 -1
- package/dist/diff/DiffResult.d.ts +0 -9
- package/dist/diff/DiffResult.d.ts.map +0 -1
- package/dist/diff/DiffResult.js +0 -18
- package/dist/diff/DiffResult.js.map +0 -1
- package/dist/diff/LionWebJsonDiff.d.ts +0 -25
- package/dist/diff/LionWebJsonDiff.d.ts.map +0 -1
- package/dist/diff/LionWebJsonDiff.js +0 -249
- package/dist/diff/LionWebJsonDiff.js.map +0 -1
- package/dist/diff/changes/Change.d.ts +0 -34
- package/dist/diff/changes/Change.d.ts.map +0 -1
- package/dist/diff/changes/Change.js +0 -38
- package/dist/diff/changes/Change.js.map +0 -1
- package/dist/diff/changes/ChunkChange.d.ts +0 -43
- package/dist/diff/changes/ChunkChange.d.ts.map +0 -1
- package/dist/diff/changes/ChunkChange.js +0 -57
- package/dist/diff/changes/ChunkChange.js.map +0 -1
- package/dist/diff/changes/ContainmentChange.d.ts +0 -25
- package/dist/diff/changes/ContainmentChange.d.ts.map +0 -1
- package/dist/diff/changes/ContainmentChange.js +0 -34
- package/dist/diff/changes/ContainmentChange.js.map +0 -1
- package/dist/diff/changes/NodeChange.d.ts +0 -41
- package/dist/diff/changes/NodeChange.d.ts.map +0 -1
- package/dist/diff/changes/NodeChange.js +0 -54
- package/dist/diff/changes/NodeChange.js.map +0 -1
- package/dist/diff/changes/PropertyChange.d.ts +0 -24
- package/dist/diff/changes/PropertyChange.d.ts.map +0 -1
- package/dist/diff/changes/PropertyChange.js +0 -29
- package/dist/diff/changes/PropertyChange.js.map +0 -1
- package/dist/diff/changes/ReferenceChange.d.ts +0 -25
- package/dist/diff/changes/ReferenceChange.d.ts.map +0 -1
- package/dist/diff/changes/ReferenceChange.js +0 -34
- package/dist/diff/changes/ReferenceChange.js.map +0 -1
- package/dist/diff/changes/index.d.ts +0 -7
- package/dist/diff/changes/index.d.ts.map +0 -1
- package/dist/diff/changes/index.js +0 -7
- package/dist/diff/changes/index.js.map +0 -1
- package/dist/diff/index.d.ts +0 -4
- package/dist/diff/index.d.ts.map +0 -1
- package/dist/diff/index.js +0 -4
- package/dist/diff/index.js.map +0 -1
- package/dist/json/ChunkUtils.d.ts +0 -26
- package/dist/json/ChunkUtils.d.ts.map +0 -1
- package/dist/json/ChunkUtils.js +0 -46
- package/dist/json/ChunkUtils.js.map +0 -1
- package/dist/json/JsonContext.d.ts +0 -11
- package/dist/json/JsonContext.d.ts.map +0 -1
- package/dist/json/JsonContext.js +0 -25
- package/dist/json/JsonContext.js.map +0 -1
- package/dist/json/LionWebJson.d.ts +0 -50
- package/dist/json/LionWebJson.d.ts.map +0 -1
- package/dist/json/LionWebJson.js +0 -27
- package/dist/json/LionWebJson.js.map +0 -1
- package/dist/json/LionWebJsonChunkWrapper.d.ts +0 -39
- package/dist/json/LionWebJsonChunkWrapper.d.ts.map +0 -1
- package/dist/json/LionWebJsonChunkWrapper.js +0 -119
- package/dist/json/LionWebJsonChunkWrapper.js.map +0 -1
- package/dist/json/M3definitions.d.ts +0 -176
- package/dist/json/M3definitions.d.ts.map +0 -1
- package/dist/json/M3definitions.js +0 -174
- package/dist/json/M3definitions.js.map +0 -1
- package/dist/json/NodeUtils.d.ts +0 -23
- package/dist/json/NodeUtils.d.ts.map +0 -1
- package/dist/json/NodeUtils.js +0 -57
- package/dist/json/NodeUtils.js.map +0 -1
- package/dist/json/index.d.ts +0 -7
- package/dist/json/index.d.ts.map +0 -1
- package/dist/json/index.js +0 -7
- package/dist/json/index.js.map +0 -1
- package/dist/util/graphs.d.ts +0 -18
- package/dist/util/graphs.d.ts.map +0 -1
- package/dist/util/graphs.js +0 -27
- package/dist/util/graphs.js.map +0 -1
- package/dist/validators/generic/ValidationTypes.d.ts +0 -44
- package/dist/validators/generic/ValidationTypes.d.ts.map +0 -1
- package/dist/validators/generic/ValidationTypes.js +0 -27
- package/dist/validators/generic/ValidationTypes.js.map +0 -1
- package/src/diff/DiffResult.ts +0 -21
- package/src/diff/LionWebJsonDiff.ts +0 -309
- package/src/diff/changes/Change.ts +0 -76
- package/src/diff/changes/ChunkChange.ts +0 -68
- package/src/diff/changes/ContainmentChange.ts +0 -32
- package/src/diff/changes/NodeChange.ts +0 -63
- package/src/diff/changes/PropertyChange.ts +0 -31
- package/src/diff/changes/ReferenceChange.ts +0 -34
- package/src/diff/changes/index.ts +0 -6
- package/src/diff/index.ts +0 -3
- package/src/json/ChunkUtils.ts +0 -49
- package/src/json/JsonContext.ts +0 -31
- package/src/json/LionWebJson.ts +0 -80
- package/src/json/LionWebJsonChunkWrapper.ts +0 -136
- package/src/json/M3definitions.ts +0 -177
- package/src/json/NodeUtils.ts +0 -75
- package/src/json/index.ts +0 -6
- package/src/util/graphs.ts +0 -36
- package/src/validators/generic/ValidationTypes.ts +0 -67
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lionweb/validation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0-alpha.10",
|
|
4
4
|
"license": "Apache 2.0",
|
|
5
5
|
"description": "LionWeb Serialization validation",
|
|
6
6
|
"author": "jos.warmer@openmodeling.nl",
|
|
@@ -14,14 +14,15 @@
|
|
|
14
14
|
"testing"
|
|
15
15
|
],
|
|
16
16
|
"scripts": {
|
|
17
|
-
"clean": "
|
|
17
|
+
"clean": "npx rimraf dist node_modules -g lionweb-validation-*.tgz",
|
|
18
18
|
"build": "tsc && npm run copyM3 && npm run copyBuiltins",
|
|
19
19
|
"copyM3": "node -e \"const fs = require('fs'); fs.copyFileSync('./src/languages/LionCore-M3.json', './dist/languages/LionCore-M3.json');\"",
|
|
20
20
|
"copyBuiltins": "node -e \"const fs = require('fs'); fs.copyFileSync('./src/languages/LionCore-builtins.json', './dist/languages/LionCore-builtins.json');\"",
|
|
21
21
|
"lint": "eslint src",
|
|
22
22
|
"test-here": "cd ../test && find dist/validation -type d | sed '1!G;h;$!d' | xargs npx mocha",
|
|
23
|
-
"release": "npm publish",
|
|
24
|
-
"release-beta": "npm publish --tag beta",
|
|
23
|
+
"release-alpha": "npm publish --registry https://registry.npmjs.org --tag alpha",
|
|
24
|
+
"release-beta": "npm publish --registry https://registry.npmjs.org --tag beta",
|
|
25
|
+
"release": "npm publish --registry https://registry.npmjs.org",
|
|
25
26
|
"testValid": "node dist/runners/RunCheckFolder.js ../test/testset/valid",
|
|
26
27
|
"testInvalid": "node dist/runners/RunCheckFolder.js ../test/testset/invalid",
|
|
27
28
|
"testInvalidWithLanguage": "node dist/runners/RunCheckFolderWithLanguage.js ../test/testset/withLanguage/invalid/ ../test/testset/withLanguage/myLang.language.json",
|
|
@@ -29,5 +30,10 @@
|
|
|
29
30
|
"publish-local": "npm publish --registry http://localhost:4873",
|
|
30
31
|
"unpublish-local": "npm unpublish --force --registry http://localhost:4873",
|
|
31
32
|
"republish-local": "yarn unpublish-local && yarn publish-local"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@lionweb/json": "0.7.0-alpha.10",
|
|
36
|
+
"@lionweb/ts-utils": "0.7.0-alpha.10",
|
|
37
|
+
"@lionweb/json-utils": "0.7.0-alpha.10"
|
|
32
38
|
}
|
|
33
39
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LionWebJsonMetaPointer, LionWebJsonNode } from "
|
|
2
|
-
import { JsonContext } from "
|
|
1
|
+
import { LionWebJsonMetaPointer, LionWebJsonNode } from "@lionweb/json"
|
|
2
|
+
import { JsonContext } from "@lionweb/json-utils"
|
|
3
3
|
import { ValidationIssue } from "./ValidationIssue.js"
|
|
4
4
|
|
|
5
5
|
export class Language_PropertyValue_Issue extends ValidationIssue {
|
|
@@ -8,13 +8,13 @@ export class Language_PropertyValue_Issue extends ValidationIssue {
|
|
|
8
8
|
constructor(
|
|
9
9
|
context: JsonContext,
|
|
10
10
|
public property: string,
|
|
11
|
-
public value:
|
|
12
|
-
public expectedType: string
|
|
11
|
+
public value: string | null,
|
|
12
|
+
public expectedType: string
|
|
13
13
|
) {
|
|
14
14
|
super(context)
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
msg = (): string => `Property
|
|
17
|
+
msg = (): string => `Property "${this.property}" with value "${this.value}" is not of type "${this.expectedType}"`
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
// Incorrect Meta Pointers
|
|
@@ -24,7 +24,7 @@ export abstract class Language_IncorrectMetaPointerType_Issue extends Validation
|
|
|
24
24
|
constructor(
|
|
25
25
|
context: JsonContext,
|
|
26
26
|
public metaPointer: LionWebJsonMetaPointer,
|
|
27
|
-
public incorrectType: string
|
|
27
|
+
public incorrectType: string
|
|
28
28
|
) {
|
|
29
29
|
super(context)
|
|
30
30
|
}
|
|
@@ -43,7 +43,7 @@ export abstract class Language_FeatureMetaPointerNotInClassifier_Issue extends V
|
|
|
43
43
|
constructor(
|
|
44
44
|
context: JsonContext,
|
|
45
45
|
public featureMetaPointer: LionWebJsonMetaPointer,
|
|
46
|
-
public classifierPointer: LionWebJsonNode
|
|
46
|
+
public classifierPointer: LionWebJsonNode
|
|
47
47
|
) {
|
|
48
48
|
super(context)
|
|
49
49
|
}
|
|
@@ -82,7 +82,7 @@ export abstract class Language_UnknownMetaPointer_Issue extends ValidationIssue
|
|
|
82
82
|
|
|
83
83
|
constructor(
|
|
84
84
|
context: JsonContext,
|
|
85
|
-
public metaPointer: LionWebJsonMetaPointer
|
|
85
|
+
public metaPointer: LionWebJsonMetaPointer
|
|
86
86
|
) {
|
|
87
87
|
super(context)
|
|
88
88
|
}
|
|
@@ -112,7 +112,7 @@ export class NumberOfLanguagesUsed_Issue extends ValidationIssue {
|
|
|
112
112
|
readonly issueType = "NumberOfLanguagesUsed"
|
|
113
113
|
constructor(
|
|
114
114
|
context: JsonContext,
|
|
115
|
-
public nrOfLanguages: number
|
|
115
|
+
public nrOfLanguages: number
|
|
116
116
|
) {
|
|
117
117
|
super(context)
|
|
118
118
|
}
|
|
@@ -120,9 +120,7 @@ export class NumberOfLanguagesUsed_Issue extends ValidationIssue {
|
|
|
120
120
|
}
|
|
121
121
|
export class MissingM3Language_Issue extends ValidationIssue {
|
|
122
122
|
readonly issueType = "MissingM3Language"
|
|
123
|
-
constructor(
|
|
124
|
-
context: JsonContext
|
|
125
|
-
) {
|
|
123
|
+
constructor(context: JsonContext) {
|
|
126
124
|
super(context)
|
|
127
125
|
}
|
|
128
126
|
msg = () => `Missing used language LionCore-M3`
|
|
@@ -131,7 +129,7 @@ export class NotLionCoreLanguageKey_Issue extends ValidationIssue {
|
|
|
131
129
|
readonly issueType = "NotLionCoreLanguageKey"
|
|
132
130
|
constructor(
|
|
133
131
|
context: JsonContext,
|
|
134
|
-
public incorrectKey: string
|
|
132
|
+
public incorrectKey: string
|
|
135
133
|
) {
|
|
136
134
|
super(context)
|
|
137
135
|
}
|
|
@@ -141,7 +139,7 @@ export class IncorrectLionCoreVersion_Issue extends ValidationIssue {
|
|
|
141
139
|
readonly issueType = "IncorrectLionCoreVersion"
|
|
142
140
|
constructor(
|
|
143
141
|
context: JsonContext,
|
|
144
|
-
public incorrectVersion: string
|
|
142
|
+
public incorrectVersion: string
|
|
145
143
|
) {
|
|
146
144
|
super(context)
|
|
147
145
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LionWebJsonMetaPointer, LionWebJsonNode } from "
|
|
2
|
-
import { JsonContext } from "
|
|
1
|
+
import { LionWebId, LionWebJsonMetaPointer, LionWebJsonNode } from "@lionweb/json"
|
|
2
|
+
import { JsonContext } from "@lionweb/json-utils"
|
|
3
3
|
import { ValidationIssue } from "./ValidationIssue.js"
|
|
4
4
|
|
|
5
5
|
export class Reference_DuplicateNodeId_Issue extends ValidationIssue {
|
|
@@ -7,7 +7,7 @@ export class Reference_DuplicateNodeId_Issue extends ValidationIssue {
|
|
|
7
7
|
|
|
8
8
|
constructor(
|
|
9
9
|
context: JsonContext,
|
|
10
|
-
public nodeId:
|
|
10
|
+
public nodeId: LionWebId
|
|
11
11
|
) {
|
|
12
12
|
super(context)
|
|
13
13
|
}
|
|
@@ -21,7 +21,7 @@ export class Reference_ChildMissingInParent_Issue extends ValidationIssue {
|
|
|
21
21
|
constructor(
|
|
22
22
|
context: JsonContext,
|
|
23
23
|
public child: LionWebJsonNode,
|
|
24
|
-
public parent: LionWebJsonNode
|
|
24
|
+
public parent: LionWebJsonNode
|
|
25
25
|
) {
|
|
26
26
|
super(context)
|
|
27
27
|
}
|
|
@@ -35,7 +35,7 @@ export class Reference_ParentMissingInChild_Issue extends ValidationIssue {
|
|
|
35
35
|
constructor(
|
|
36
36
|
context: JsonContext,
|
|
37
37
|
public parent: LionWebJsonNode,
|
|
38
|
-
public child: LionWebJsonNode
|
|
38
|
+
public child: LionWebJsonNode
|
|
39
39
|
) {
|
|
40
40
|
super(context)
|
|
41
41
|
}
|
|
@@ -49,7 +49,7 @@ export class Reference_CirculairParent_Issue extends ValidationIssue {
|
|
|
49
49
|
constructor(
|
|
50
50
|
context: JsonContext,
|
|
51
51
|
public node: LionWebJsonNode | undefined,
|
|
52
|
-
public parentPath: string[]
|
|
52
|
+
public parentPath: string[]
|
|
53
53
|
) {
|
|
54
54
|
super(context)
|
|
55
55
|
}
|
|
@@ -62,7 +62,7 @@ export class Reference_LanguageUnknown_Issue extends ValidationIssue {
|
|
|
62
62
|
|
|
63
63
|
constructor(
|
|
64
64
|
context: JsonContext,
|
|
65
|
-
public languageRef: LionWebJsonMetaPointer
|
|
65
|
+
public languageRef: LionWebJsonMetaPointer
|
|
66
66
|
) {
|
|
67
67
|
super(context)
|
|
68
68
|
}
|
|
@@ -75,9 +75,9 @@ export class Duplicates_Issue extends ValidationIssue {
|
|
|
75
75
|
|
|
76
76
|
constructor(
|
|
77
77
|
context: JsonContext,
|
|
78
|
-
public
|
|
78
|
+
public nodeId: LionWebId
|
|
79
79
|
) {
|
|
80
80
|
super(context)
|
|
81
81
|
}
|
|
82
|
-
msg = () => `Duplicate value "${this.
|
|
82
|
+
msg = () => `Duplicate value "${this.nodeId}"`
|
|
83
83
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { JsonContext } from "
|
|
1
|
+
import { JsonContext } from "@lionweb/json-utils"
|
|
2
2
|
import { ValidationIssue } from "./ValidationIssue.js"
|
|
3
3
|
|
|
4
4
|
export abstract class Syntax_PropertyIssue extends ValidationIssue {
|
|
5
5
|
constructor(
|
|
6
6
|
public context: JsonContext,
|
|
7
|
-
protected property: string
|
|
7
|
+
protected property: string
|
|
8
8
|
) {
|
|
9
9
|
super(context)
|
|
10
10
|
}
|
|
@@ -32,7 +32,7 @@ export class Syntax_PropertyTypeIssue extends Syntax_PropertyIssue {
|
|
|
32
32
|
context: JsonContext,
|
|
33
33
|
property: string,
|
|
34
34
|
protected expectedType: string,
|
|
35
|
-
protected actualType: string
|
|
35
|
+
protected actualType: string
|
|
36
36
|
) {
|
|
37
37
|
super(context, property)
|
|
38
38
|
}
|
|
@@ -46,7 +46,7 @@ export class Syntax_ArrayContainsNull_Issue extends Syntax_PropertyIssue {
|
|
|
46
46
|
constructor(
|
|
47
47
|
context: JsonContext,
|
|
48
48
|
property: string,
|
|
49
|
-
public index: number
|
|
49
|
+
public index: number
|
|
50
50
|
) {
|
|
51
51
|
super(context, property)
|
|
52
52
|
}
|
|
@@ -57,7 +57,7 @@ export class Syntax_ArrayContainsNull_Issue extends Syntax_PropertyIssue {
|
|
|
57
57
|
export abstract class Syntax_IncorrectFormat_Issue extends ValidationIssue {
|
|
58
58
|
constructor(
|
|
59
59
|
context: JsonContext,
|
|
60
|
-
public value: string
|
|
60
|
+
public value: string
|
|
61
61
|
) {
|
|
62
62
|
super(context)
|
|
63
63
|
}
|
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
import { JsonContext } from "
|
|
1
|
+
import { JsonContext } from "@lionweb/json-utils"
|
|
2
2
|
|
|
3
3
|
export abstract class ValidationIssue {
|
|
4
4
|
abstract readonly issueType: string
|
|
5
|
-
context: JsonContext
|
|
5
|
+
context: JsonContext | null
|
|
6
6
|
|
|
7
|
-
constructor(context: JsonContext) {
|
|
7
|
+
constructor(context: JsonContext | null) {
|
|
8
8
|
this.context = context
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
protected abstract msg(): string
|
|
12
12
|
|
|
13
13
|
public errorMsg(): string {
|
|
14
|
-
return `${this.issueType}: ${this.msg()} at ${this.context
|
|
14
|
+
return `${this.issueType}: ${this.msg()} at ${this.context?.toString()} `
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export class GenericIssue extends ValidationIssue {
|
|
19
19
|
readonly issueType = "GenericIssue"
|
|
20
|
-
|
|
21
|
-
constructor(
|
|
20
|
+
|
|
21
|
+
constructor(
|
|
22
|
+
context: JsonContext | null,
|
|
23
|
+
public text: string
|
|
24
|
+
) {
|
|
22
25
|
super(context)
|
|
23
26
|
}
|
|
24
|
-
|
|
27
|
+
|
|
25
28
|
protected msg = () => this.text
|
|
26
29
|
}
|
package/src/issues/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LionWebId, LionWebJsonMetaPointer, LionWebJsonNode } from "
|
|
1
|
+
import { LionWebId, LionWebJsonMetaPointer, LionWebJsonNode } from "@lionweb/json"
|
|
2
2
|
import { LionWebLanguageWrapper } from "./LionWebLanguageWrapper.js"
|
|
3
3
|
import { MetaPointerMap } from "./MetaPointerMap.js"
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LionWebId, LionWebJsonMetaPointer, LionWebJsonNode } from "
|
|
1
|
+
import { LionWebId, LionWebJsonMetaPointer, LionWebJsonNode } from "@lionweb/json"
|
|
2
2
|
import { CompositeLionWebLanguageWrapper } from "./CompositeLionWebLanguageWrapper.js"
|
|
3
3
|
import { LionWebLanguageWrapper } from "./LionWebLanguageWrapper.js"
|
|
4
4
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { isEqualMetaPointer,
|
|
2
|
-
import { LION_CORE_M3_KEY, MetaPointers } from "
|
|
1
|
+
import { isEqualMetaPointer, LionWebJsonChunk, LionWebJsonNode } from "@lionweb/json"
|
|
2
|
+
import { LION_CORE_M3_KEY, MetaPointers } from "@lionweb/json-utils"
|
|
3
3
|
|
|
4
|
-
import { createRequire } from
|
|
4
|
+
import { createRequire } from "module"
|
|
5
5
|
|
|
6
|
-
const require = createRequire(import.meta.url)
|
|
7
|
-
const LionCore_M3 = require(
|
|
8
|
-
const LionCore_builtins = require(
|
|
6
|
+
const require = createRequire(import.meta.url)
|
|
7
|
+
const LionCore_M3 = require("./LionCore-M3.json")
|
|
8
|
+
const LionCore_builtins = require("./LionCore-builtins.json")
|
|
9
9
|
|
|
10
10
|
export const LionCore_M3_Json = LionCore_M3 as LionWebJsonChunk
|
|
11
11
|
export const LionCore_builtins_Json = LionCore_builtins as LionWebJsonChunk
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
NodeUtils
|
|
5
|
-
} from "../json/index.js"
|
|
6
|
-
import { LionWebJsonChunk, LionWebJsonNode } from "../json/LionWebJson.js"
|
|
7
|
-
import { visitAndMap } from "../util/graphs.js"
|
|
1
|
+
import { LionWebJsonChunk, LionWebJsonNode, LionWebKey } from "@lionweb/json"
|
|
2
|
+
import { LionWebJsonChunkWrapper, MetaPointers, NodeUtils } from "@lionweb/json-utils"
|
|
3
|
+
import { visitAndMap } from "@lionweb/ts-utils"
|
|
8
4
|
import { isAnnotation, isConcept, isContainment, isInterface, isProperty, isReference } from "./LanguageUtils.js"
|
|
9
5
|
|
|
10
6
|
interface LionWebLanguageWrapperInterface {
|
|
@@ -24,8 +20,8 @@ interface LionWebLanguageWrapperInterface {
|
|
|
24
20
|
export class LionWebLanguageWrapper extends LionWebJsonChunkWrapper implements LionWebLanguageWrapperInterface {
|
|
25
21
|
name: string
|
|
26
22
|
version: string
|
|
27
|
-
key:
|
|
28
|
-
|
|
23
|
+
key: LionWebKey
|
|
24
|
+
|
|
29
25
|
constructor(chunk: LionWebJsonChunk) {
|
|
30
26
|
super(chunk)
|
|
31
27
|
const languageNode: LionWebJsonNode = this.findNodesOfClassifier(MetaPointers.Language)[0]
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { LionWebJsonMetaPointer, LionWebJsonNode,
|
|
1
|
+
import { LionWebJsonMetaPointer, LionWebJsonNode, LionWebKey } from "@lionweb/json"
|
|
2
|
+
import { MetaPointers, NodeUtils } from "@lionweb/json-utils"
|
|
2
3
|
|
|
3
4
|
export class MetaPointerMap {
|
|
4
5
|
/**
|
|
5
6
|
* Map from languageKey => languageVersion => key => LionWebJsonNode
|
|
6
7
|
*/
|
|
7
8
|
map: Map<string, Map<string, Map<string, LionWebJsonNode>>> = new Map<string, Map<string, Map<string, LionWebJsonNode>>>()
|
|
8
|
-
|
|
9
|
-
add(languageKey:
|
|
9
|
+
|
|
10
|
+
add(languageKey: LionWebKey, languageVersion: string, node: LionWebJsonNode): void {
|
|
10
11
|
const keyProperty = NodeUtils.findProperty(node, MetaPointers.IKeyedKey)
|
|
11
12
|
if (keyProperty === undefined) {
|
|
12
13
|
console.log("MetaPointerMap.add: trying to add node without key property.")
|
|
@@ -17,9 +18,9 @@ export class MetaPointerMap {
|
|
|
17
18
|
console.log("MetaPointerMap.add: trying to add node without key property being empty or null.")
|
|
18
19
|
return
|
|
19
20
|
}
|
|
20
|
-
this.set({language: languageKey, version: languageVersion, key: key}, node)
|
|
21
|
+
this.set({ language: languageKey, version: languageVersion, key: key }, node)
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
+
|
|
23
24
|
set(mp: LionWebJsonMetaPointer, node: LionWebJsonNode): void {
|
|
24
25
|
let language = this.map.get(mp.language)
|
|
25
26
|
if (language === undefined) {
|
|
@@ -33,7 +34,7 @@ export class MetaPointerMap {
|
|
|
33
34
|
}
|
|
34
35
|
version.set(mp.key, node)
|
|
35
36
|
}
|
|
36
|
-
|
|
37
|
+
|
|
37
38
|
get(mp: LionWebJsonMetaPointer): LionWebJsonNode | undefined {
|
|
38
39
|
return this.map.get(mp.language)?.get(mp.version)?.get(mp.key)
|
|
39
40
|
}
|
package/src/runners/FileUtils.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "fs"
|
|
2
2
|
import { LanguageRegistry } from "../languages/index.js"
|
|
3
|
-
import { LionWebValidator } from "../validators/LionWebValidator.js"
|
|
4
3
|
import { ValidationResult } from "../validators/generic/ValidationResult.js"
|
|
4
|
+
import { LionWebValidator } from "../validators/LionWebValidator.js"
|
|
5
5
|
import { getFilesRecursive, printIssues } from "./Utils.js"
|
|
6
6
|
|
|
7
7
|
export function validateFile(file: string, registry: LanguageRegistry): void {
|
|
@@ -28,7 +28,7 @@ if (languageValidator.validationResult.hasErrors()) {
|
|
|
28
28
|
for (const modelFile of getFilesRecursive(folder, [])) {
|
|
29
29
|
const jsonString1 = fs.readFileSync(modelFile, "utf-8")
|
|
30
30
|
const jsonModel = JSON.parse(jsonString1)
|
|
31
|
-
const modelValidator = new LionWebValidator(jsonModel, registry
|
|
31
|
+
const modelValidator = new LionWebValidator(jsonModel, registry)
|
|
32
32
|
|
|
33
33
|
modelValidator.validateAll()
|
|
34
34
|
if (modelValidator.validationResult.hasErrors()) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { LionWebJsonChunk } from "@lionweb/json"
|
|
2
|
+
import { LionWebJsonDiff } from "@lionweb/json-diff"
|
|
1
3
|
import fs from "fs"
|
|
2
|
-
import { LionWebJsonDiff } from "../diff/index.js"
|
|
3
|
-
import { LionWebJsonChunk } from "../json/LionWebJson.js"
|
|
4
4
|
|
|
5
5
|
const file1 = process.argv[2]
|
|
6
6
|
const file2 = process.argv[3]
|
package/src/runners/Utils.ts
CHANGED
|
@@ -48,7 +48,7 @@ export function printIssues(result: ValidationResult, file?: string): void {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
export function issuestoString(vresult: ValidationResult, file?: string): string {
|
|
51
|
-
let result = ""
|
|
52
|
-
vresult.issues.forEach(issue => (result += (file
|
|
51
|
+
let result = "ISSUES: "
|
|
52
|
+
vresult.issues.forEach(issue => (result += (file === undefined ? "NOFILE" : `File ${file}: `) + issue.errorMsg() + "\n"))
|
|
53
53
|
return result
|
|
54
54
|
}
|
|
@@ -1,104 +1,102 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
validateKey,
|
|
4
|
-
validateSerializationFormatVersion,
|
|
5
|
-
validateVersion
|
|
6
|
-
} from "./ValidationFunctions.js"
|
|
7
|
-
import { MAY_BE_NULL, PropertyDef, PropertyDefinition } from "./generic/ValidationTypes.js"
|
|
1
|
+
import { DefinitionSchema, MAY_BE_NULL, PropertyDef, PrimitiveDef } from "./generic/index.js"
|
|
2
|
+
import { validateId, validateKey, validateSerializationFormatVersion, validateVersion } from "./ValidationFunctions.js"
|
|
8
3
|
|
|
9
4
|
/**
|
|
10
5
|
* The structure below defines the structure of a LionWeb Chunk by defining all the properties.
|
|
11
6
|
* It can
|
|
12
|
-
* - be
|
|
13
|
-
* - used to generate all the types for a LionWebChunk.
|
|
7
|
+
* - be used by the SyntaxValidator to validate an object sat runtime.
|
|
8
|
+
* - used to generate all the TypeScript types for a LionWebChunk.
|
|
14
9
|
*/
|
|
15
|
-
export const
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
[
|
|
19
|
-
PropertyDef({
|
|
20
|
-
PropertyDef({
|
|
21
|
-
PropertyDef({
|
|
10
|
+
export const LionWebSchema: DefinitionSchema = new DefinitionSchema([
|
|
11
|
+
{
|
|
12
|
+
name: "LionWebJsonMetaPointer",
|
|
13
|
+
properties: [
|
|
14
|
+
PropertyDef({ name: "key", type: "LionWebKey" }),
|
|
15
|
+
PropertyDef({ name: "version", type: "LionWebVersion" }),
|
|
16
|
+
PropertyDef({ name: "language", type: "LionWebKey" })
|
|
22
17
|
]
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
[
|
|
27
|
-
PropertyDef({
|
|
28
|
-
PropertyDef({
|
|
29
|
-
PropertyDef({
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: "LionWebJsonMetaPointer",
|
|
21
|
+
properties: [
|
|
22
|
+
PropertyDef({ name: "key", type: "LionWebKey" }),
|
|
23
|
+
PropertyDef({ name: "version", type: "LionWebVersion" }),
|
|
24
|
+
PropertyDef({ name: "language", type: "LionWebKey" }),
|
|
30
25
|
]
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
[
|
|
35
|
-
PropertyDef({
|
|
36
|
-
PropertyDef({
|
|
37
|
-
PropertyDef({
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: "ResponseMessage",
|
|
29
|
+
properties: [
|
|
30
|
+
PropertyDef({ name: "kind", type: "JSstring" }),
|
|
31
|
+
PropertyDef({ name: "message", type: "JSstring" }),
|
|
32
|
+
PropertyDef({ name: "data", type: "JSobject", mayBeNull: true, isOptional: true })
|
|
38
33
|
]
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
[
|
|
43
|
-
PropertyDef({
|
|
44
|
-
PropertyDef({
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "LionWebJsonChunk",
|
|
37
|
+
properties: [
|
|
38
|
+
PropertyDef({ name: "serializationFormatVersion", type: "LionWebSerializationFormatVersion" }),
|
|
39
|
+
PropertyDef({ name: "languages", type: "LionWebJsonUsedLanguage", isList: true }),
|
|
40
|
+
PropertyDef({ name: "nodes", type: "LionWebJsonNode", isList: true })
|
|
45
41
|
]
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
[
|
|
50
|
-
PropertyDef({
|
|
51
|
-
PropertyDef({
|
|
52
|
-
PropertyDef({ property: "properties", expectedType: "LionWebProperty", isList: true }),
|
|
53
|
-
PropertyDef({ property: "containments", expectedType: "LionWebContainment", isList: true }),
|
|
54
|
-
PropertyDef({ property: "references", expectedType: "LionWebReference", isList: true }),
|
|
55
|
-
PropertyDef({ property: "annotations", expectedType: "string", isList: true, validate: validateId }),
|
|
56
|
-
PropertyDef({ property: "parent", expectedType: "string", mayBeNull: MAY_BE_NULL, validate: validateId }),
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "LionWebJsonUsedLanguage",
|
|
45
|
+
properties: [
|
|
46
|
+
PropertyDef({ name: "key", type: "LionWebKey" }),
|
|
47
|
+
PropertyDef({ name: "version", type: "LionWebVersion" })
|
|
57
48
|
]
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"
|
|
61
|
-
[
|
|
62
|
-
PropertyDef({
|
|
63
|
-
PropertyDef({
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "LionWebJsonNode",
|
|
52
|
+
properties: [
|
|
53
|
+
PropertyDef({ name: "id", type: "LionWebId" }),
|
|
54
|
+
PropertyDef({ name: "classifier", type: "LionWebJsonMetaPointer" }),
|
|
55
|
+
PropertyDef({ name: "properties", type: "LionWebJsonProperty", isList: true }),
|
|
56
|
+
PropertyDef({ name: "containments", type: "LionWebJsonContainment", isList: true }),
|
|
57
|
+
PropertyDef({ name: "references", type: "LionWebJsonReference", isList: true }),
|
|
58
|
+
PropertyDef({ name: "annotations", type: "LionWebId", isList: true }),
|
|
59
|
+
PropertyDef({ name: "parent", type: "LionWebId", mayBeNull: MAY_BE_NULL }),
|
|
64
60
|
]
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"
|
|
68
|
-
[
|
|
69
|
-
PropertyDef({
|
|
70
|
-
PropertyDef({
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "LionWebJsonProperty",
|
|
64
|
+
properties: [
|
|
65
|
+
PropertyDef({ name: "property", type: "LionWebJsonMetaPointer" }),
|
|
66
|
+
PropertyDef({ name: "value", type: "JSstring", mayBeNull: MAY_BE_NULL }),
|
|
71
67
|
]
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
"
|
|
75
|
-
[
|
|
76
|
-
PropertyDef({
|
|
77
|
-
PropertyDef({
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "LionWebJsonContainment",
|
|
71
|
+
properties: [
|
|
72
|
+
PropertyDef({ name: "containment", type: "LionWebJsonMetaPointer" }),
|
|
73
|
+
PropertyDef({ name: "children", type: "LionWebId", isList: true }),
|
|
78
74
|
]
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
"
|
|
82
|
-
[
|
|
83
|
-
PropertyDef({
|
|
84
|
-
PropertyDef({
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: "LionWebJsonReference",
|
|
78
|
+
properties: [
|
|
79
|
+
PropertyDef({ name: "reference", type: "LionWebJsonMetaPointer"}),
|
|
80
|
+
PropertyDef({ name: "targets", type: "LionWebJsonReferenceTarget", isList: true}),
|
|
85
81
|
]
|
|
86
|
-
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: "LionWebJsonReferenceTarget",
|
|
85
|
+
properties: [
|
|
86
|
+
PropertyDef({ name: "resolveInfo", type: "JSstring", mayBeNull: MAY_BE_NULL }),
|
|
87
|
+
PropertyDef({ name: "reference", type: "LionWebId", mayBeNull: MAY_BE_NULL }),
|
|
88
|
+
]
|
|
89
|
+
},
|
|
87
90
|
/**
|
|
88
|
-
* Elements without properties are assumed to be JSON/JS primitive values, and tested using `typeof
|
|
91
|
+
* Elements without properties are assumed to be JSON/JS primitive values, and tested using `typeof`
|
|
92
|
+
* and the (optional) validate function.
|
|
89
93
|
*/
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
[]
|
|
97
|
-
],
|
|
98
|
-
[
|
|
99
|
-
"boolean",
|
|
100
|
-
[]
|
|
101
|
-
],
|
|
94
|
+
PrimitiveDef({ name: "LionWebId", primitiveType: "string", validate: validateId }),
|
|
95
|
+
PrimitiveDef({ name: "LionWebKey", primitiveType: "string", validate: validateKey }),
|
|
96
|
+
PrimitiveDef({ name: "LionWebVersion",primitiveType: "string", validate: validateVersion }),
|
|
97
|
+
PrimitiveDef({ name: "LionWebSerializationFormatVersion",primitiveType: "string", validate: validateSerializationFormatVersion }),
|
|
98
|
+
PrimitiveDef({ name: "JSstring", primitiveType: "string" }),
|
|
99
|
+
PrimitiveDef({ name: "JSobject",primitiveType: "object" }),
|
|
102
100
|
])
|
|
103
101
|
|
|
104
102
|
|