@lionweb/validation 0.5.0 → 0.6.0-beta.2
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/README.md +2 -0
- package/dist/diff/DiffResult.d.ts +9 -0
- package/dist/diff/DiffResult.d.ts.map +1 -0
- package/dist/diff/DiffResult.js +18 -0
- package/dist/diff/DiffResult.js.map +1 -0
- package/dist/diff/LionWebJsonDiff.d.ts +25 -0
- package/dist/diff/LionWebJsonDiff.d.ts.map +1 -0
- package/dist/diff/LionWebJsonDiff.js +205 -0
- package/dist/diff/LionWebJsonDiff.js.map +1 -0
- package/dist/diff/changes/Change.d.ts +16 -0
- package/dist/diff/changes/Change.d.ts.map +1 -0
- package/dist/diff/changes/Change.js +19 -0
- package/dist/diff/changes/Change.js.map +1 -0
- package/dist/diff/changes/ChunkChange.d.ts +43 -0
- package/dist/diff/changes/ChunkChange.d.ts.map +1 -0
- package/dist/diff/changes/ChunkChange.js +57 -0
- package/dist/diff/changes/ChunkChange.js.map +1 -0
- package/dist/diff/changes/ContainmentChange.d.ts +26 -0
- package/dist/diff/changes/ContainmentChange.d.ts.map +1 -0
- package/dist/diff/changes/ContainmentChange.js +34 -0
- package/dist/diff/changes/ContainmentChange.js.map +1 -0
- package/dist/diff/changes/NodeChange.d.ts +22 -0
- package/dist/diff/changes/NodeChange.d.ts.map +1 -0
- package/dist/diff/changes/NodeChange.js +24 -0
- package/dist/diff/changes/NodeChange.js.map +1 -0
- package/dist/diff/changes/PropertyChange.d.ts +23 -0
- package/dist/diff/changes/PropertyChange.d.ts.map +1 -0
- package/dist/diff/changes/PropertyChange.js +28 -0
- package/dist/diff/changes/PropertyChange.js.map +1 -0
- package/dist/diff/changes/ReferenceChange.d.ts +19 -0
- package/dist/diff/changes/ReferenceChange.d.ts.map +1 -0
- package/dist/diff/changes/ReferenceChange.js +25 -0
- package/dist/diff/changes/ReferenceChange.js.map +1 -0
- package/dist/diff/changes/index.d.ts +7 -0
- package/dist/diff/changes/index.d.ts.map +1 -0
- package/dist/diff/changes/index.js +7 -0
- package/dist/diff/changes/index.js.map +1 -0
- package/dist/diff/index.d.ts +4 -0
- package/dist/diff/index.d.ts.map +1 -0
- package/dist/diff/index.js +4 -0
- package/dist/diff/index.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/issues/LanguageIssues.d.ts +1 -1
- package/dist/issues/LanguageIssues.d.ts.map +1 -1
- package/dist/issues/LanguageIssues.js.map +1 -1
- package/dist/issues/ReferenceIssues.d.ts +1 -1
- package/dist/issues/ReferenceIssues.d.ts.map +1 -1
- 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/SyntaxIssues.js +4 -4
- package/dist/issues/SyntaxIssues.js.map +1 -1
- package/dist/issues/ValidationIssue.d.ts +1 -1
- package/dist/issues/ValidationIssue.d.ts.map +1 -1
- package/dist/issues/ValidationIssue.js.map +1 -1
- package/dist/issues/index.d.ts +1 -1
- package/dist/issues/index.d.ts.map +1 -1
- package/dist/issues/index.js +1 -1
- package/dist/issues/index.js.map +1 -1
- package/dist/json/ChunkUtils.d.ts.map +1 -1
- package/dist/json/ChunkUtils.js.map +1 -1
- package/dist/json/JsonContext.d.ts.map +1 -0
- package/dist/json/JsonContext.js.map +1 -0
- package/dist/json/LanguageUtils.d.ts.map +1 -1
- package/dist/json/LanguageUtils.js.map +1 -1
- package/dist/json/LionWebJson.d.ts +10 -9
- package/dist/json/LionWebJson.d.ts.map +1 -1
- package/dist/json/LionWebJson.js +1 -0
- package/dist/json/LionWebJson.js.map +1 -1
- package/dist/json/LionWebJsonChunkWrapper.d.ts +7 -4
- package/dist/json/LionWebJsonChunkWrapper.d.ts.map +1 -1
- package/dist/json/LionWebJsonChunkWrapper.js +48 -10
- package/dist/json/LionWebJsonChunkWrapper.js.map +1 -1
- package/dist/json/LionWebLanguageDefinition.d.ts.map +1 -1
- package/dist/json/LionWebLanguageDefinition.js +3 -3
- package/dist/json/LionWebLanguageDefinition.js.map +1 -1
- package/dist/json/NodeUtils.d.ts +5 -4
- package/dist/json/NodeUtils.d.ts.map +1 -1
- package/dist/json/NodeUtils.js +5 -2
- package/dist/json/NodeUtils.js.map +1 -1
- package/dist/json/index.d.ts +1 -0
- package/dist/json/index.d.ts.map +1 -1
- package/dist/json/index.js +1 -0
- package/dist/json/index.js.map +1 -1
- package/dist/runners/FileUtils.d.ts.map +1 -1
- package/dist/runners/FileUtils.js.map +1 -1
- package/dist/runners/RunCheckFolder.js.map +1 -1
- package/dist/runners/RunCheckFolderWithLanguage.js.map +1 -1
- package/dist/runners/RunCheckOneFile.js.map +1 -1
- package/dist/runners/RunCheckOneFileWithLanguage.js.map +1 -1
- package/dist/runners/RunLioncoreDiff.js +5 -5
- package/dist/runners/RunLioncoreDiff.js.map +1 -1
- package/dist/runners/Utils.d.ts.map +1 -1
- package/dist/runners/Utils.js +1 -1
- package/dist/runners/Utils.js.map +1 -1
- package/dist/runners/index.d.ts.map +1 -1
- package/dist/runners/index.js.map +1 -1
- package/dist/validators/LionWebLanguageReferenceValidator.d.ts +1 -1
- package/dist/validators/LionWebLanguageReferenceValidator.d.ts.map +1 -1
- package/dist/validators/LionWebLanguageReferenceValidator.js +6 -6
- package/dist/validators/LionWebLanguageReferenceValidator.js.map +1 -1
- package/dist/validators/LionWebLanguageValidator.d.ts.map +1 -1
- package/dist/validators/LionWebLanguageValidator.js +1 -1
- package/dist/validators/LionWebLanguageValidator.js.map +1 -1
- package/dist/validators/LionWebReferenceValidator.d.ts +1 -1
- package/dist/validators/LionWebReferenceValidator.d.ts.map +1 -1
- package/dist/validators/LionWebReferenceValidator.js +6 -6
- package/dist/validators/LionWebReferenceValidator.js.map +1 -1
- package/dist/validators/LionWebSyntaxValidator.d.ts +1 -1
- package/dist/validators/LionWebSyntaxValidator.d.ts.map +1 -1
- package/dist/validators/LionWebSyntaxValidator.js +21 -11
- package/dist/validators/LionWebSyntaxValidator.js.map +1 -1
- package/dist/validators/LionWebValidator.d.ts.map +1 -1
- package/dist/validators/LionWebValidator.js.map +1 -1
- package/dist/validators/SimpleFieldValidator.d.ts +1 -1
- package/dist/validators/SimpleFieldValidator.d.ts.map +1 -1
- package/dist/validators/SimpleFieldValidator.js +1 -1
- package/dist/validators/SimpleFieldValidator.js.map +1 -1
- package/dist/validators/ValidationResult.d.ts.map +1 -1
- package/dist/validators/ValidationResult.js.map +1 -1
- package/dist/validators/index.d.ts.map +1 -1
- package/dist/validators/index.js.map +1 -1
- package/package.json +5 -2
- package/src/diff/DiffResult.ts +21 -0
- package/src/diff/LionWebJsonDiff.ts +259 -0
- package/src/diff/changes/Change.ts +52 -0
- package/src/diff/changes/ChunkChange.ts +68 -0
- package/src/diff/changes/ContainmentChange.ts +34 -0
- package/src/diff/changes/NodeChange.ts +32 -0
- package/src/diff/changes/PropertyChange.ts +29 -0
- package/src/diff/changes/ReferenceChange.ts +24 -0
- package/src/diff/changes/index.ts +6 -0
- package/src/diff/index.ts +3 -0
- package/src/index.ts +5 -4
- package/src/issues/LanguageIssues.ts +61 -39
- package/src/issues/ReferenceIssues.ts +51 -29
- package/src/issues/SyntaxIssues.ts +38 -23
- package/src/issues/ValidationIssue.ts +7 -7
- package/src/issues/index.ts +5 -5
- package/src/json/ChunkUtils.ts +7 -11
- package/src/json/JsonContext.ts +31 -0
- package/src/json/LanguageUtils.ts +5 -6
- package/src/json/LionWebJson.ts +44 -43
- package/src/json/LionWebJsonChunkWrapper.ts +76 -29
- package/src/json/LionWebLanguageDefinition.ts +44 -49
- package/src/json/NodeUtils.ts +25 -19
- package/src/json/index.ts +7 -6
- package/src/json/std-builtins-copy.json +347 -349
- package/src/runners/FileUtils.ts +48 -49
- package/src/runners/RunCheckFolder.ts +3 -3
- package/src/runners/RunCheckFolderWithLanguage.ts +31 -30
- package/src/runners/RunCheckOneFile.ts +3 -3
- package/src/runners/RunCheckOneFileWithLanguage.ts +21 -19
- package/src/runners/RunLioncoreDiff.ts +15 -15
- package/src/runners/Utils.ts +24 -24
- package/src/runners/index.ts +2 -2
- package/src/validators/LionWebLanguageReferenceValidator.ts +63 -55
- package/src/validators/LionWebLanguageValidator.ts +11 -12
- package/src/validators/LionWebReferenceValidator.ts +90 -76
- package/src/validators/LionWebSyntaxValidator.ts +108 -99
- package/src/validators/LionWebValidator.ts +33 -33
- package/src/validators/SimpleFieldValidator.ts +33 -28
- package/src/validators/ValidationResult.ts +5 -6
- package/src/validators/index.ts +7 -7
- package/dist/diff/LionwebDiff.d.ts +0 -40
- package/dist/diff/LionwebDiff.d.ts.map +0 -1
- package/dist/diff/LionwebDiff.js +0 -158
- package/dist/diff/LionwebDiff.js.map +0 -1
- package/dist/issues/JsonContext.d.ts.map +0 -1
- package/dist/issues/JsonContext.js.map +0 -1
- package/src/diff/LionwebDiff.ts +0 -193
- package/src/issues/JsonContext.ts +0 -31
- /package/dist/{issues → json}/JsonContext.d.ts +0 -0
- /package/dist/{issues → json}/JsonContext.js +0 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { JsonContext } from "../../issues/index.js"
|
|
2
|
+
|
|
3
|
+
export type ChangeType =
|
|
4
|
+
| "GenericChange"
|
|
5
|
+
| "NodeRemoved"
|
|
6
|
+
| "NodeAdded"
|
|
7
|
+
| "ChildRemoved"
|
|
8
|
+
| "ChildAdded"
|
|
9
|
+
| "ParentChanged"
|
|
10
|
+
| "PropertyValueChanged"
|
|
11
|
+
| "SerializationFormatChange"
|
|
12
|
+
| "PropertyRemoved"
|
|
13
|
+
| "PropertyAdded"
|
|
14
|
+
| "NodeClassifierChanged"
|
|
15
|
+
| "ContainmentAdded"
|
|
16
|
+
| "ContainmentRemoved"
|
|
17
|
+
| "LanguageRemoved"
|
|
18
|
+
| "LanguageAdded"
|
|
19
|
+
| "TargetAdded"
|
|
20
|
+
| "TargetRemoved"
|
|
21
|
+
| "ReferenceRemoved"
|
|
22
|
+
| "ReferenceAdded"
|
|
23
|
+
|
|
24
|
+
export abstract class Change {
|
|
25
|
+
abstract readonly id: ChangeType
|
|
26
|
+
context: JsonContext
|
|
27
|
+
|
|
28
|
+
constructor(context: JsonContext) {
|
|
29
|
+
this.context = context
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
protected abstract msg(): string
|
|
33
|
+
|
|
34
|
+
public changeMsg(): string {
|
|
35
|
+
return `${this.id}: ${this.msg()} at ${this.context.toString()} `
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export class GenericChange extends Change {
|
|
40
|
+
readonly id = "GenericChange"
|
|
41
|
+
|
|
42
|
+
constructor(
|
|
43
|
+
context: JsonContext,
|
|
44
|
+
protected message: string,
|
|
45
|
+
) {
|
|
46
|
+
super(context)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
protected msg(): string {
|
|
50
|
+
return this.message
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { JsonContext } from "../../issues/index.js"
|
|
2
|
+
import { LionWebJsonNode, LwJsonUsedLanguage } from "../../json/index.js"
|
|
3
|
+
import { Change } from "./Change.js"
|
|
4
|
+
|
|
5
|
+
export abstract class ChunkChange extends Change {
|
|
6
|
+
constructor(public context: JsonContext) {
|
|
7
|
+
super(context)
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class SerializationFormatChange extends ChunkChange {
|
|
12
|
+
readonly id = "SerializationFormatChange"
|
|
13
|
+
|
|
14
|
+
constructor(
|
|
15
|
+
public context: JsonContext,
|
|
16
|
+
protected original: string,
|
|
17
|
+
protected newValue: string,
|
|
18
|
+
) {
|
|
19
|
+
super(context)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
protected msg = () => `Serialization versions do not match: ${this.original} vs ${this.newValue}`
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export class NodeRemoved extends ChunkChange {
|
|
26
|
+
readonly id = "NodeRemoved"
|
|
27
|
+
|
|
28
|
+
constructor(
|
|
29
|
+
public context: JsonContext,
|
|
30
|
+
public node: LionWebJsonNode,
|
|
31
|
+
) {
|
|
32
|
+
super(context)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
protected msg = () => `Node ${this.node.id} is removed`
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export class NodeAdded extends ChunkChange {
|
|
39
|
+
readonly id = "NodeAdded"
|
|
40
|
+
|
|
41
|
+
constructor(
|
|
42
|
+
public context: JsonContext,
|
|
43
|
+
public node: LionWebJsonNode,
|
|
44
|
+
) {
|
|
45
|
+
super(context)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
protected msg = () => `Node ${this.node.id} is added`
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export abstract class LanguageChange extends ChunkChange {
|
|
52
|
+
constructor(
|
|
53
|
+
public context: JsonContext,
|
|
54
|
+
public language: LwJsonUsedLanguage,
|
|
55
|
+
) {
|
|
56
|
+
super(context)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export class LanguageRemoved extends LanguageChange {
|
|
61
|
+
readonly id = "LanguageRemoved"
|
|
62
|
+
protected msg = () => `Language with key ${this.language.key} and version ${this.language.version} is removed`
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export class LanguageAdded extends LanguageChange {
|
|
66
|
+
readonly id = "LanguageAdded"
|
|
67
|
+
protected msg = () => `Language with key ${this.language.key} and version ${this.language.version} is added`
|
|
68
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { JsonContext } from "../../issues/index.js"
|
|
2
|
+
import { LionWebJsonMetaPointer, LionWebJsonNode } from "../../json/index.js"
|
|
3
|
+
import { Change } from "./Change.js"
|
|
4
|
+
|
|
5
|
+
export abstract class ContainmentChange extends Change {
|
|
6
|
+
constructor(
|
|
7
|
+
public context: JsonContext,
|
|
8
|
+
public parentNode: LionWebJsonNode,
|
|
9
|
+
public containment: LionWebJsonMetaPointer,
|
|
10
|
+
public childId: string,
|
|
11
|
+
) {
|
|
12
|
+
super(context)
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class ChildAdded extends ContainmentChange {
|
|
17
|
+
readonly id = "ChildAdded"
|
|
18
|
+
protected msg = () => `Node "${this.parentNode.id}" added child "${this.childId}" to containment ${this.containment.key}`
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export class ChildRemoved extends ContainmentChange {
|
|
22
|
+
readonly id = "ChildRemoved"
|
|
23
|
+
protected msg = () => `Node "${this.parentNode.id}" removed child "${this.childId}"`
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export class ContainmentAdded extends Change {
|
|
27
|
+
readonly id = "ContainmentAdded";
|
|
28
|
+
constructor(ctx: JsonContext, public node: LionWebJsonNode, public containment: LionWebJsonMetaPointer) {
|
|
29
|
+
super(ctx)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
protected msg = () => `Node "${this.node.id}" containment added: "${JSON.stringify(this.containment)}"`
|
|
33
|
+
}
|
|
34
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { JsonContext } from "../../issues/index.js"
|
|
2
|
+
import { LionWebJsonMetaPointer, LionWebJsonNode } from "../../json/index.js"
|
|
3
|
+
import { Change, ChangeType } from "./Change.js"
|
|
4
|
+
|
|
5
|
+
export class NodeClassifierChanged extends Change {
|
|
6
|
+
readonly id: ChangeType = "NodeClassifierChanged"
|
|
7
|
+
|
|
8
|
+
constructor(
|
|
9
|
+
public context: JsonContext,
|
|
10
|
+
public node: LionWebJsonNode,
|
|
11
|
+
public oldClassifier: LionWebJsonMetaPointer,
|
|
12
|
+
public newClassifier: LionWebJsonMetaPointer,
|
|
13
|
+
) {
|
|
14
|
+
super(context)
|
|
15
|
+
}
|
|
16
|
+
protected msg = () => `Object ${this.node.id} has classifier changed from ${this.oldClassifier.key} to ${this.newClassifier.key}`
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export class ParentChanged extends Change {
|
|
20
|
+
readonly id = "ParentChanged"
|
|
21
|
+
|
|
22
|
+
constructor(
|
|
23
|
+
public context: JsonContext,
|
|
24
|
+
public node: LionWebJsonNode,
|
|
25
|
+
public beforeParentId: string | null,
|
|
26
|
+
public afterParentId: string | null,
|
|
27
|
+
) {
|
|
28
|
+
super(context)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
protected msg = () => `Node "${this.node.id}" changed parent from "${this.beforeParentId}" to "${this.afterParentId}`
|
|
32
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { JsonContext } from "../../issues/index.js"
|
|
2
|
+
import { LionWebJsonMetaPointer, LionWebJsonNode } from "../../json/index.js"
|
|
3
|
+
import { Change } from "./Change.js"
|
|
4
|
+
|
|
5
|
+
export abstract class PropertyChange extends Change {
|
|
6
|
+
constructor(
|
|
7
|
+
public context: JsonContext,
|
|
8
|
+
public nodeId: string,
|
|
9
|
+
public property: LionWebJsonMetaPointer,
|
|
10
|
+
public oldValue: string | undefined,
|
|
11
|
+
public newValue: string | undefined,
|
|
12
|
+
) {
|
|
13
|
+
super(context)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export class PropertyValueChanged extends PropertyChange {
|
|
18
|
+
readonly id = "PropertyValueChanged"
|
|
19
|
+
protected msg = () => `Node "${this.nodeId} changed value of property "${this.property.key}" from "${this.oldValue}" to "${this.newValue}"`
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export class PropertyAdded extends Change {
|
|
23
|
+
readonly id = "PropertyAdded";
|
|
24
|
+
constructor(ctx: JsonContext, public node: LionWebJsonNode, public property: LionWebJsonMetaPointer) {
|
|
25
|
+
super(ctx)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
protected msg = () => `Node "${this.node.id}" containment added: "${JSON.stringify(this.property)}"`
|
|
29
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { JsonContext } from "../../issues/index.js"
|
|
2
|
+
import { LionWebJsonMetaPointer, LionWebJsonNode } from "../../json/index.js"
|
|
3
|
+
import { Change } from "./Change.js"
|
|
4
|
+
|
|
5
|
+
export abstract class ReferenceChange extends Change {
|
|
6
|
+
constructor(
|
|
7
|
+
public context: JsonContext,
|
|
8
|
+
public node: LionWebJsonNode,
|
|
9
|
+
public reference: LionWebJsonMetaPointer,
|
|
10
|
+
public targetId: string,
|
|
11
|
+
) {
|
|
12
|
+
super(context)
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class TargetAdded extends ReferenceChange {
|
|
17
|
+
readonly id = "TargetAdded"
|
|
18
|
+
protected msg = () => `Node "${this.node.id}" added target "${this.targetId}" to reference "${this.reference.key}"`
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export class TargetRemoved extends ReferenceChange {
|
|
22
|
+
readonly id = "TargetRemoved"
|
|
23
|
+
protected msg = () => `Node "${this.node.id}" removed target "${this.targetId}" from reference "${this.reference.key}"`
|
|
24
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export * from "./issues/index.js"
|
|
2
|
-
export * from "./json/index.js"
|
|
3
|
-
export * from "./validators/index.js"
|
|
4
|
-
export * from "./
|
|
1
|
+
export * from "./issues/index.js"
|
|
2
|
+
export * from "./json/index.js"
|
|
3
|
+
export * from "./validators/index.js"
|
|
4
|
+
export * from "./diff/index.js"
|
|
5
|
+
export * from "./runners/index.js"
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import { LionWebJsonMetaPointer } from "../json/LionWebJson.js"
|
|
2
|
-
import { JsonContext } from "
|
|
3
|
-
import { ValidationIssue } from "./ValidationIssue.js"
|
|
1
|
+
import { LionWebJsonMetaPointer } from "../json/LionWebJson.js"
|
|
2
|
+
import { JsonContext } from "../json/JsonContext.js"
|
|
3
|
+
import { ValidationIssue } from "./ValidationIssue.js"
|
|
4
4
|
|
|
5
5
|
export class Language_PropertyValue_Issue extends ValidationIssue {
|
|
6
|
-
readonly id = "PropertyValue"
|
|
6
|
+
readonly id = "PropertyValue"
|
|
7
7
|
|
|
8
|
-
constructor(
|
|
9
|
-
|
|
8
|
+
constructor(
|
|
9
|
+
context: JsonContext,
|
|
10
|
+
public property: string,
|
|
11
|
+
public value: string,
|
|
12
|
+
public expectedType: string,
|
|
13
|
+
) {
|
|
14
|
+
super(context)
|
|
10
15
|
}
|
|
11
16
|
|
|
12
17
|
msg = (): string => `Property "${this.property}" with value "${this.value}" is not of type "${this.expectedType}"`
|
|
@@ -14,79 +19,96 @@ export class Language_PropertyValue_Issue extends ValidationIssue {
|
|
|
14
19
|
|
|
15
20
|
// Incorrect Meta Pointers
|
|
16
21
|
export abstract class Language_IncorrectMetaPointerType_Issue extends ValidationIssue {
|
|
17
|
-
abstract readonly metaType: string
|
|
22
|
+
abstract readonly metaType: string
|
|
18
23
|
|
|
19
|
-
constructor(
|
|
20
|
-
|
|
24
|
+
constructor(
|
|
25
|
+
context: JsonContext,
|
|
26
|
+
public metaPointer: LionWebJsonMetaPointer,
|
|
27
|
+
public incorrectType: string,
|
|
28
|
+
) {
|
|
29
|
+
super(context)
|
|
21
30
|
}
|
|
22
31
|
|
|
23
|
-
msg = (): string =>
|
|
32
|
+
msg = (): string =>
|
|
33
|
+
`${this.metaType} with key "${this.metaPointer.key}" does not refer to a ${this.metaType}, but to a "${this.incorrectType}"`
|
|
24
34
|
}
|
|
25
35
|
|
|
26
36
|
export class Language_IncorrectPropertyMetaPointer_Issue extends Language_IncorrectMetaPointerType_Issue {
|
|
27
|
-
readonly id = "IncorrectPropertyMetaPointer"
|
|
28
|
-
readonly metaType = "Property"
|
|
37
|
+
readonly id = "IncorrectPropertyMetaPointer"
|
|
38
|
+
readonly metaType = "Property"
|
|
29
39
|
}
|
|
30
40
|
export class Language_IncorrectConceptMetaPointer_Issue extends Language_IncorrectMetaPointerType_Issue {
|
|
31
|
-
readonly id = "IncorrectConceptMetaPointer"
|
|
32
|
-
readonly metaType = "Concept"
|
|
41
|
+
readonly id = "IncorrectConceptMetaPointer"
|
|
42
|
+
readonly metaType = "Concept"
|
|
33
43
|
}
|
|
34
44
|
export class Language_IncorrectReferenceMetaPointer_Issue extends Language_IncorrectMetaPointerType_Issue {
|
|
35
|
-
readonly id = "IncorrectReferenceMetaPointer"
|
|
36
|
-
readonly metaType = "Reference"
|
|
45
|
+
readonly id = "IncorrectReferenceMetaPointer"
|
|
46
|
+
readonly metaType = "Reference"
|
|
37
47
|
}
|
|
38
48
|
export class Language_IncorrectContainmentMetaPointer_Issue extends Language_IncorrectMetaPointerType_Issue {
|
|
39
|
-
readonly id = "IncorrectContainmentMetaPointer"
|
|
40
|
-
readonly metaType = "Containment"
|
|
49
|
+
readonly id = "IncorrectContainmentMetaPointer"
|
|
50
|
+
readonly metaType = "Containment"
|
|
41
51
|
}
|
|
42
52
|
|
|
43
53
|
// Unknown Meta Pointers
|
|
44
54
|
export abstract class Language_UnknownMetaPointer_Issue extends ValidationIssue {
|
|
45
|
-
abstract readonly metaType: string
|
|
55
|
+
abstract readonly metaType: string
|
|
46
56
|
|
|
47
|
-
constructor(
|
|
48
|
-
|
|
57
|
+
constructor(
|
|
58
|
+
context: JsonContext,
|
|
59
|
+
public metaPointer: LionWebJsonMetaPointer,
|
|
60
|
+
) {
|
|
61
|
+
super(context)
|
|
49
62
|
}
|
|
50
63
|
|
|
51
|
-
msg = (): string => `${this.metaType} with key ${this.metaPointer.key} is unknown in the language
|
|
64
|
+
msg = (): string => `${this.metaType} with key ${this.metaPointer.key} is unknown in the language`
|
|
52
65
|
}
|
|
53
66
|
|
|
54
67
|
export class Language_UnknownReference_Issue extends Language_UnknownMetaPointer_Issue {
|
|
55
|
-
readonly id = "UnknownReference"
|
|
56
|
-
readonly metaType = "Reference"
|
|
68
|
+
readonly id = "UnknownReference"
|
|
69
|
+
readonly metaType = "Reference"
|
|
57
70
|
}
|
|
58
71
|
export class Language_UnknownContainment_Issue extends Language_UnknownMetaPointer_Issue {
|
|
59
|
-
readonly id = "UnknownContainment"
|
|
60
|
-
readonly metaType = "Containment"
|
|
72
|
+
readonly id = "UnknownContainment"
|
|
73
|
+
readonly metaType = "Containment"
|
|
61
74
|
}
|
|
62
75
|
export class Language_UnknownProperty_Issue extends Language_UnknownMetaPointer_Issue {
|
|
63
|
-
readonly id = "UnknownProperty"
|
|
64
|
-
readonly metaType = "Property"
|
|
76
|
+
readonly id = "UnknownProperty"
|
|
77
|
+
readonly metaType = "Property"
|
|
65
78
|
}
|
|
66
79
|
export class Language_UnknownConcept_Issue extends Language_UnknownMetaPointer_Issue {
|
|
67
|
-
readonly id = "UnknownConcept"
|
|
68
|
-
readonly metaType = "Concept"
|
|
80
|
+
readonly id = "UnknownConcept"
|
|
81
|
+
readonly metaType = "Concept"
|
|
69
82
|
}
|
|
70
83
|
|
|
71
84
|
// Actual Language checks on M2
|
|
72
85
|
export class NumberOfLanguagesUsed_Issue extends ValidationIssue {
|
|
73
|
-
readonly id = "NumberOfLanguagesUsed"
|
|
74
|
-
constructor(
|
|
75
|
-
|
|
86
|
+
readonly id = "NumberOfLanguagesUsed"
|
|
87
|
+
constructor(
|
|
88
|
+
context: JsonContext,
|
|
89
|
+
public nrOfLanguages: number,
|
|
90
|
+
) {
|
|
91
|
+
super(context)
|
|
76
92
|
}
|
|
77
93
|
msg = () => `Is not a language: number of used languages should be 1, is ${this.nrOfLanguages}`
|
|
78
94
|
}
|
|
79
95
|
export class NotLionCoreLanguageKey_Issue extends ValidationIssue {
|
|
80
|
-
readonly id = "NotLionCoreLanguageKey"
|
|
81
|
-
constructor(
|
|
82
|
-
|
|
96
|
+
readonly id = "NotLionCoreLanguageKey"
|
|
97
|
+
constructor(
|
|
98
|
+
context: JsonContext,
|
|
99
|
+
public incorrectKey: string,
|
|
100
|
+
) {
|
|
101
|
+
super(context)
|
|
83
102
|
}
|
|
84
103
|
msg = () => `Is not a language: the used language key is not LionCore-M3, but ${this.incorrectKey}`
|
|
85
104
|
}
|
|
86
105
|
export class IncorrectLionCoreVersion_Issue extends ValidationIssue {
|
|
87
|
-
readonly id = "IncorrectLionCoreVersion"
|
|
88
|
-
constructor(
|
|
89
|
-
|
|
106
|
+
readonly id = "IncorrectLionCoreVersion"
|
|
107
|
+
constructor(
|
|
108
|
+
context: JsonContext,
|
|
109
|
+
public incorrectVersion: string,
|
|
110
|
+
) {
|
|
111
|
+
super(context)
|
|
90
112
|
}
|
|
91
113
|
msg = () => `Is not a language: the used language version is not 1, but ${this.incorrectVersion}`
|
|
92
114
|
}
|
|
@@ -1,61 +1,83 @@
|
|
|
1
|
-
import { LionWebJsonMetaPointer, LionWebJsonNode } from "../json/LionWebJson.js"
|
|
2
|
-
import { JsonContext } from "
|
|
3
|
-
import { ValidationIssue } from "./ValidationIssue.js"
|
|
1
|
+
import { LionWebJsonMetaPointer, LionWebJsonNode } from "../json/LionWebJson.js"
|
|
2
|
+
import { JsonContext } from "../json/JsonContext.js"
|
|
3
|
+
import { ValidationIssue } from "./ValidationIssue.js"
|
|
4
4
|
|
|
5
5
|
export class Reference_DuplicateNodeId_Issue extends ValidationIssue {
|
|
6
|
-
readonly id = "DuplicateNodeId"
|
|
7
|
-
|
|
8
|
-
constructor(
|
|
9
|
-
|
|
6
|
+
readonly id = "DuplicateNodeId"
|
|
7
|
+
|
|
8
|
+
constructor(
|
|
9
|
+
context: JsonContext,
|
|
10
|
+
public nodeId: string,
|
|
11
|
+
) {
|
|
12
|
+
super(context)
|
|
10
13
|
}
|
|
11
|
-
|
|
12
|
-
msg = ()
|
|
14
|
+
|
|
15
|
+
msg = (): string => `Node has duplicate id "${this.nodeId}"`
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
export class Reference_ChildMissingInParent_Issue extends ValidationIssue {
|
|
16
|
-
readonly id = "ChildMissingInParent"
|
|
19
|
+
readonly id = "ChildMissingInParent"
|
|
17
20
|
|
|
18
|
-
constructor(
|
|
19
|
-
|
|
21
|
+
constructor(
|
|
22
|
+
context: JsonContext,
|
|
23
|
+
public child: LionWebJsonNode,
|
|
24
|
+
public parent: LionWebJsonNode,
|
|
25
|
+
) {
|
|
26
|
+
super(context)
|
|
20
27
|
}
|
|
21
28
|
|
|
22
|
-
msg = ()
|
|
29
|
+
msg = (): string => `Node with id "${this.child.id}" has parent with id "${this.parent.id}" but parent does not contains it as a child.`
|
|
23
30
|
}
|
|
24
31
|
|
|
25
32
|
export class Reference_ParentMissingInChild_Issue extends ValidationIssue {
|
|
26
|
-
readonly id = "ParentMissingInChild"
|
|
33
|
+
readonly id = "ParentMissingInChild"
|
|
27
34
|
|
|
28
|
-
constructor(
|
|
29
|
-
|
|
35
|
+
constructor(
|
|
36
|
+
context: JsonContext,
|
|
37
|
+
public parent: LionWebJsonNode,
|
|
38
|
+
public child: LionWebJsonNode,
|
|
39
|
+
) {
|
|
40
|
+
super(context)
|
|
30
41
|
}
|
|
31
42
|
|
|
32
|
-
msg = ()
|
|
43
|
+
msg = (): string => `Node with id "${this.parent.id}" has child with id "${this.child.id}" but child has empty parent.`
|
|
33
44
|
}
|
|
34
45
|
|
|
35
46
|
export class Reference_CirculairParent_Issue extends ValidationIssue {
|
|
36
|
-
readonly id = "CirculairParent"
|
|
47
|
+
readonly id = "CirculairParent"
|
|
37
48
|
|
|
38
|
-
constructor(
|
|
39
|
-
|
|
49
|
+
constructor(
|
|
50
|
+
context: JsonContext,
|
|
51
|
+
public node: LionWebJsonNode | undefined,
|
|
52
|
+
public parentPath: string[],
|
|
53
|
+
) {
|
|
54
|
+
super(context)
|
|
40
55
|
}
|
|
41
56
|
|
|
42
|
-
msg = ()
|
|
57
|
+
msg = (): string => `Node with id "${this.node?.id}" has circulair parent through "${this.parentPath}".`
|
|
43
58
|
}
|
|
44
59
|
|
|
45
60
|
export class Reference_LanguageUnknown_Issue extends ValidationIssue {
|
|
46
|
-
readonly id = "LanguageUnknown"
|
|
47
|
-
|
|
48
|
-
constructor(
|
|
49
|
-
|
|
61
|
+
readonly id = "LanguageUnknown"
|
|
62
|
+
|
|
63
|
+
constructor(
|
|
64
|
+
context: JsonContext,
|
|
65
|
+
public languageRef: LionWebJsonMetaPointer,
|
|
66
|
+
) {
|
|
67
|
+
super(context)
|
|
50
68
|
}
|
|
51
|
-
msg = () =>
|
|
69
|
+
msg = () =>
|
|
70
|
+
`Node uses language { language = ${this.languageRef.language}, version = ${this.languageRef.version} } which is not declared in used languages`
|
|
52
71
|
}
|
|
53
72
|
|
|
54
73
|
export class Duplicates_Issue extends ValidationIssue {
|
|
55
|
-
readonly id = "Duplicates"
|
|
74
|
+
readonly id = "Duplicates"
|
|
56
75
|
|
|
57
|
-
constructor(
|
|
58
|
-
|
|
76
|
+
constructor(
|
|
77
|
+
context: JsonContext,
|
|
78
|
+
public nodeid: string,
|
|
79
|
+
) {
|
|
80
|
+
super(context)
|
|
59
81
|
}
|
|
60
82
|
msg = () => `Duplicate value "${this.nodeid}"`
|
|
61
83
|
}
|
|
@@ -1,69 +1,84 @@
|
|
|
1
|
-
import { JsonContext } from "
|
|
2
|
-
import { ValidationIssue } from "./ValidationIssue.js"
|
|
1
|
+
import { JsonContext } from "../json/JsonContext.js"
|
|
2
|
+
import { ValidationIssue } from "./ValidationIssue.js"
|
|
3
3
|
|
|
4
4
|
export abstract class Syntax_PropertyIssue extends ValidationIssue {
|
|
5
|
-
constructor(
|
|
6
|
-
|
|
5
|
+
constructor(
|
|
6
|
+
public context: JsonContext,
|
|
7
|
+
protected property: string,
|
|
8
|
+
) {
|
|
9
|
+
super(context)
|
|
7
10
|
}
|
|
8
11
|
}
|
|
9
12
|
|
|
10
13
|
export class Syntax_PropertyMissingIssue extends Syntax_PropertyIssue {
|
|
11
|
-
readonly id =
|
|
12
|
-
protected msg = () => `Property "${this.property}" is missing
|
|
14
|
+
readonly id = "PropertyMissing"
|
|
15
|
+
protected msg = () => `Property "${this.property}" is missing`
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
export class Syntax_PropertyUnknownIssue extends Syntax_PropertyIssue {
|
|
16
|
-
readonly id =
|
|
17
|
-
protected msg = () => `Property "${this.property}" is not defined as a LionWeb property
|
|
19
|
+
readonly id = "PropertyUnknown"
|
|
20
|
+
protected msg = () => `Property "${this.property}" is not defined as a LionWeb property`
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
export class Syntax_PropertyNullIssue extends Syntax_PropertyIssue {
|
|
21
|
-
readonly id =
|
|
22
|
-
protected msg = () => `Property "${this.property}" is null, but it should have a value
|
|
24
|
+
readonly id = "PropertyNull"
|
|
25
|
+
protected msg = () => `Property "${this.property}" is null, but it should have a value`
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
export class Syntax_PropertyTypeIssue extends Syntax_PropertyIssue {
|
|
26
|
-
readonly id =
|
|
29
|
+
readonly id = "PropertyTypeIncorrect"
|
|
27
30
|
|
|
28
|
-
constructor(
|
|
29
|
-
|
|
31
|
+
constructor(
|
|
32
|
+
context: JsonContext,
|
|
33
|
+
property: string,
|
|
34
|
+
protected expectedType: string,
|
|
35
|
+
protected actualType: string,
|
|
36
|
+
) {
|
|
37
|
+
super(context, property)
|
|
30
38
|
}
|
|
31
39
|
|
|
32
|
-
protected msg = () => `Property ${this.property} should have type "${this.expectedType}", but has type "${this.actualType}"
|
|
40
|
+
protected msg = () => `Property ${this.property} should have type "${this.expectedType}", but has type "${this.actualType}"`
|
|
33
41
|
}
|
|
34
42
|
|
|
35
43
|
export class Syntax_ArrayContainsNull_Issue extends Syntax_PropertyIssue {
|
|
36
|
-
readonly id = "ArrayContainsNull"
|
|
44
|
+
readonly id = "ArrayContainsNull"
|
|
37
45
|
|
|
38
|
-
constructor(
|
|
39
|
-
|
|
46
|
+
constructor(
|
|
47
|
+
context: JsonContext,
|
|
48
|
+
property: string,
|
|
49
|
+
public index: number,
|
|
50
|
+
) {
|
|
51
|
+
super(context, property)
|
|
40
52
|
}
|
|
41
53
|
|
|
42
54
|
protected msg = () => `Property "${this.property}" of type array contains null at index "${"" + this.index}" `
|
|
43
55
|
}
|
|
44
56
|
|
|
45
57
|
export abstract class Syntax_IncorrectFormat_Issue extends ValidationIssue {
|
|
46
|
-
constructor(
|
|
47
|
-
|
|
58
|
+
constructor(
|
|
59
|
+
context: JsonContext,
|
|
60
|
+
public value: string,
|
|
61
|
+
) {
|
|
62
|
+
super(context)
|
|
48
63
|
}
|
|
49
64
|
}
|
|
50
65
|
|
|
51
66
|
export class Syntax_SerializationFormatVersion_Issue extends Syntax_IncorrectFormat_Issue {
|
|
52
|
-
readonly id = "SerializationFormatVersion"
|
|
67
|
+
readonly id = "SerializationFormatVersion"
|
|
53
68
|
protected msg = () => `SerializationFormatVersion "${this.value}" is not a number`
|
|
54
69
|
}
|
|
55
70
|
|
|
56
71
|
export class Syntax_VersionFormat_Issue extends Syntax_IncorrectFormat_Issue {
|
|
57
|
-
readonly id = "VersionFormat"
|
|
72
|
+
readonly id = "VersionFormat"
|
|
58
73
|
protected msg = () => `Version "${this.value}" is an empty string.`
|
|
59
74
|
}
|
|
60
75
|
|
|
61
76
|
export class Syntax_KeyFormat_Issue extends Syntax_IncorrectFormat_Issue {
|
|
62
|
-
readonly id = "KeyFormat"
|
|
77
|
+
readonly id = "KeyFormat"
|
|
63
78
|
protected msg = () => `Key "${this.value}" has incorrect format.`
|
|
64
79
|
}
|
|
65
80
|
|
|
66
81
|
export class Syntax_IdFormat_Issue extends Syntax_IncorrectFormat_Issue {
|
|
67
|
-
readonly id = "IdFormat"
|
|
82
|
+
readonly id = "IdFormat"
|
|
68
83
|
protected msg = () => `Id "${this.value}" has incorrect format.`
|
|
69
84
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { JsonContext } from "
|
|
1
|
+
import { JsonContext } from "../json/JsonContext.js"
|
|
2
2
|
|
|
3
3
|
export abstract class ValidationIssue {
|
|
4
|
-
abstract readonly id: string
|
|
5
|
-
context: JsonContext
|
|
6
|
-
|
|
4
|
+
abstract readonly id: string
|
|
5
|
+
context: JsonContext
|
|
6
|
+
|
|
7
7
|
constructor(context: JsonContext) {
|
|
8
|
-
this.context = context
|
|
8
|
+
this.context = context
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
protected abstract msg(): string
|
|
12
|
-
|
|
11
|
+
protected abstract msg(): string
|
|
12
|
+
|
|
13
13
|
public errorMsg(): string {
|
|
14
14
|
return `${this.id}: ${this.msg()} at ${this.context.toString()} `
|
|
15
15
|
}
|