@domainlang/language 0.1.20
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 +163 -0
- package/out/ast-augmentation.d.ts +6 -0
- package/out/ast-augmentation.js +2 -0
- package/out/ast-augmentation.js.map +1 -0
- package/out/domain-lang-module.d.ts +57 -0
- package/out/domain-lang-module.js +67 -0
- package/out/domain-lang-module.js.map +1 -0
- package/out/generated/ast.d.ts +759 -0
- package/out/generated/ast.js +556 -0
- package/out/generated/ast.js.map +1 -0
- package/out/generated/grammar.d.ts +6 -0
- package/out/generated/grammar.js +2407 -0
- package/out/generated/grammar.js.map +1 -0
- package/out/generated/module.d.ts +13 -0
- package/out/generated/module.js +21 -0
- package/out/generated/module.js.map +1 -0
- package/out/index.d.ts +16 -0
- package/out/index.js +22 -0
- package/out/index.js.map +1 -0
- package/out/lsp/domain-lang-code-actions.d.ts +55 -0
- package/out/lsp/domain-lang-code-actions.js +143 -0
- package/out/lsp/domain-lang-code-actions.js.map +1 -0
- package/out/lsp/domain-lang-completion.d.ts +37 -0
- package/out/lsp/domain-lang-completion.js +452 -0
- package/out/lsp/domain-lang-completion.js.map +1 -0
- package/out/lsp/domain-lang-formatter.d.ts +15 -0
- package/out/lsp/domain-lang-formatter.js +43 -0
- package/out/lsp/domain-lang-formatter.js.map +1 -0
- package/out/lsp/domain-lang-naming.d.ts +34 -0
- package/out/lsp/domain-lang-naming.js +49 -0
- package/out/lsp/domain-lang-naming.js.map +1 -0
- package/out/lsp/domain-lang-scope.d.ts +59 -0
- package/out/lsp/domain-lang-scope.js +102 -0
- package/out/lsp/domain-lang-scope.js.map +1 -0
- package/out/lsp/domain-lang-workspace-manager.d.ts +21 -0
- package/out/lsp/domain-lang-workspace-manager.js +93 -0
- package/out/lsp/domain-lang-workspace-manager.js.map +1 -0
- package/out/lsp/hover/ddd-pattern-explanations.d.ts +50 -0
- package/out/lsp/hover/ddd-pattern-explanations.js +196 -0
- package/out/lsp/hover/ddd-pattern-explanations.js.map +1 -0
- package/out/lsp/hover/domain-lang-hover.d.ts +19 -0
- package/out/lsp/hover/domain-lang-hover.js +302 -0
- package/out/lsp/hover/domain-lang-hover.js.map +1 -0
- package/out/lsp/hover/domain-lang-keywords.d.ts +13 -0
- package/out/lsp/hover/domain-lang-keywords.js +47 -0
- package/out/lsp/hover/domain-lang-keywords.js.map +1 -0
- package/out/lsp/manifest-diagnostics.d.ts +82 -0
- package/out/lsp/manifest-diagnostics.js +230 -0
- package/out/lsp/manifest-diagnostics.js.map +1 -0
- package/out/main-browser.d.ts +1 -0
- package/out/main-browser.js +11 -0
- package/out/main-browser.js.map +1 -0
- package/out/main.d.ts +1 -0
- package/out/main.js +74 -0
- package/out/main.js.map +1 -0
- package/out/sdk/ast-augmentation.d.ts +136 -0
- package/out/sdk/ast-augmentation.js +62 -0
- package/out/sdk/ast-augmentation.js.map +1 -0
- package/out/sdk/index.d.ts +94 -0
- package/out/sdk/index.js +97 -0
- package/out/sdk/index.js.map +1 -0
- package/out/sdk/indexes.d.ts +16 -0
- package/out/sdk/indexes.js +97 -0
- package/out/sdk/indexes.js.map +1 -0
- package/out/sdk/loader-node.d.ts +51 -0
- package/out/sdk/loader-node.js +119 -0
- package/out/sdk/loader-node.js.map +1 -0
- package/out/sdk/loader.d.ts +49 -0
- package/out/sdk/loader.js +85 -0
- package/out/sdk/loader.js.map +1 -0
- package/out/sdk/patterns.d.ts +93 -0
- package/out/sdk/patterns.js +123 -0
- package/out/sdk/patterns.js.map +1 -0
- package/out/sdk/query.d.ts +90 -0
- package/out/sdk/query.js +679 -0
- package/out/sdk/query.js.map +1 -0
- package/out/sdk/resolution.d.ts +52 -0
- package/out/sdk/resolution.js +68 -0
- package/out/sdk/resolution.js.map +1 -0
- package/out/sdk/types.d.ts +280 -0
- package/out/sdk/types.js +8 -0
- package/out/sdk/types.js.map +1 -0
- package/out/services/dependency-analyzer.d.ts +58 -0
- package/out/services/dependency-analyzer.js +254 -0
- package/out/services/dependency-analyzer.js.map +1 -0
- package/out/services/dependency-resolver.d.ts +146 -0
- package/out/services/dependency-resolver.js +452 -0
- package/out/services/dependency-resolver.js.map +1 -0
- package/out/services/git-url-resolver.browser.d.ts +10 -0
- package/out/services/git-url-resolver.browser.js +19 -0
- package/out/services/git-url-resolver.browser.js.map +1 -0
- package/out/services/git-url-resolver.d.ts +158 -0
- package/out/services/git-url-resolver.js +416 -0
- package/out/services/git-url-resolver.js.map +1 -0
- package/out/services/governance-validator.d.ts +44 -0
- package/out/services/governance-validator.js +153 -0
- package/out/services/governance-validator.js.map +1 -0
- package/out/services/import-resolver.d.ts +77 -0
- package/out/services/import-resolver.js +240 -0
- package/out/services/import-resolver.js.map +1 -0
- package/out/services/performance-optimizer.d.ts +60 -0
- package/out/services/performance-optimizer.js +140 -0
- package/out/services/performance-optimizer.js.map +1 -0
- package/out/services/relationship-inference.d.ts +11 -0
- package/out/services/relationship-inference.js +98 -0
- package/out/services/relationship-inference.js.map +1 -0
- package/out/services/semver.d.ts +98 -0
- package/out/services/semver.js +195 -0
- package/out/services/semver.js.map +1 -0
- package/out/services/types.d.ts +340 -0
- package/out/services/types.js +46 -0
- package/out/services/types.js.map +1 -0
- package/out/services/workspace-manager.d.ts +123 -0
- package/out/services/workspace-manager.js +489 -0
- package/out/services/workspace-manager.js.map +1 -0
- package/out/syntaxes/domain-lang.monarch.d.ts +76 -0
- package/out/syntaxes/domain-lang.monarch.js +29 -0
- package/out/syntaxes/domain-lang.monarch.js.map +1 -0
- package/out/utils/import-utils.d.ts +49 -0
- package/out/utils/import-utils.js +128 -0
- package/out/utils/import-utils.js.map +1 -0
- package/out/validation/bounded-context.d.ts +11 -0
- package/out/validation/bounded-context.js +79 -0
- package/out/validation/bounded-context.js.map +1 -0
- package/out/validation/classification.d.ts +3 -0
- package/out/validation/classification.js +3 -0
- package/out/validation/classification.js.map +1 -0
- package/out/validation/constants.d.ts +180 -0
- package/out/validation/constants.js +235 -0
- package/out/validation/constants.js.map +1 -0
- package/out/validation/domain-lang-validator.d.ts +2 -0
- package/out/validation/domain-lang-validator.js +27 -0
- package/out/validation/domain-lang-validator.js.map +1 -0
- package/out/validation/domain.d.ts +11 -0
- package/out/validation/domain.js +63 -0
- package/out/validation/domain.js.map +1 -0
- package/out/validation/import.d.ts +68 -0
- package/out/validation/import.js +237 -0
- package/out/validation/import.js.map +1 -0
- package/out/validation/manifest.d.ts +144 -0
- package/out/validation/manifest.js +327 -0
- package/out/validation/manifest.js.map +1 -0
- package/out/validation/maps.d.ts +21 -0
- package/out/validation/maps.js +60 -0
- package/out/validation/maps.js.map +1 -0
- package/out/validation/metadata.d.ts +7 -0
- package/out/validation/metadata.js +16 -0
- package/out/validation/metadata.js.map +1 -0
- package/out/validation/model.d.ts +12 -0
- package/out/validation/model.js +29 -0
- package/out/validation/model.js.map +1 -0
- package/out/validation/relationships.d.ts +12 -0
- package/out/validation/relationships.js +94 -0
- package/out/validation/relationships.js.map +1 -0
- package/out/validation/shared.d.ts +6 -0
- package/out/validation/shared.js +12 -0
- package/out/validation/shared.js.map +1 -0
- package/package.json +110 -0
- package/src/ast-augmentation.ts +5 -0
- package/src/domain-lang-module.ts +112 -0
- package/src/domain-lang.langium +351 -0
- package/src/generated/ast.ts +986 -0
- package/src/generated/grammar.ts +2409 -0
- package/src/generated/module.ts +25 -0
- package/src/index.ts +24 -0
- package/src/lsp/domain-lang-code-actions.ts +189 -0
- package/src/lsp/domain-lang-completion.ts +514 -0
- package/src/lsp/domain-lang-formatter.ts +51 -0
- package/src/lsp/domain-lang-naming.ts +56 -0
- package/src/lsp/domain-lang-scope.ts +137 -0
- package/src/lsp/domain-lang-workspace-manager.ts +104 -0
- package/src/lsp/hover/ddd-pattern-explanations.ts +237 -0
- package/src/lsp/hover/domain-lang-hover.ts +338 -0
- package/src/lsp/hover/domain-lang-keywords.ts +50 -0
- package/src/lsp/manifest-diagnostics.ts +290 -0
- package/src/main-browser.ts +15 -0
- package/src/main.ts +85 -0
- package/src/sdk/README.md +297 -0
- package/src/sdk/ast-augmentation.ts +157 -0
- package/src/sdk/index.ts +126 -0
- package/src/sdk/indexes.ts +155 -0
- package/src/sdk/loader-node.ts +146 -0
- package/src/sdk/loader.ts +99 -0
- package/src/sdk/patterns.ts +147 -0
- package/src/sdk/query.ts +802 -0
- package/src/sdk/resolution.ts +78 -0
- package/src/sdk/types.ts +323 -0
- package/src/services/dependency-analyzer.ts +321 -0
- package/src/services/dependency-resolver.ts +551 -0
- package/src/services/git-url-resolver.browser.ts +26 -0
- package/src/services/git-url-resolver.ts +517 -0
- package/src/services/governance-validator.ts +177 -0
- package/src/services/import-resolver.ts +292 -0
- package/src/services/performance-optimizer.ts +170 -0
- package/src/services/relationship-inference.ts +121 -0
- package/src/services/semver.ts +213 -0
- package/src/services/types.ts +415 -0
- package/src/services/workspace-manager.ts +607 -0
- package/src/syntaxes/domain-lang.monarch.ts +29 -0
- package/src/utils/import-utils.ts +152 -0
- package/src/validation/bounded-context.ts +99 -0
- package/src/validation/classification.ts +5 -0
- package/src/validation/constants.ts +304 -0
- package/src/validation/domain-lang-validator.ts +33 -0
- package/src/validation/domain.ts +77 -0
- package/src/validation/import.ts +295 -0
- package/src/validation/manifest.ts +439 -0
- package/src/validation/maps.ts +76 -0
- package/src/validation/metadata.ts +18 -0
- package/src/validation/model.ts +37 -0
- package/src/validation/relationships.ts +154 -0
- package/src/validation/shared.ts +14 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import.js","sourceRoot":"","sources":["../../src/validation/import.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAQ7B,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEtF;;;;;;;;;;GAUG;AACH,MAAM,OAAO,eAAe;IAGxB,YAAY,QAA4B;QACpC,IAAI,CAAC,gBAAgB,GAAG,QAAQ,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B,CAAC;IACL,CAAC;CACJ;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAA4B;IAC3D,MAAM,SAAS,GAAG,IAAI,eAAe,CAAC,QAAQ,CAAC,CAAC;IAEhD,OAAO;QACH,+DAA+D;QAC/D,eAAe,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE;YAChD,MAAM,QAAQ,GAAG,GAAG,CAAC,SAAS,CAAC;YAC/B,IAAI,CAAC,QAAQ;gBAAE,OAAO;YAEtB,MAAM,SAAS,CAAC,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;QACxE,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manifest Validation for DomainLang.
|
|
3
|
+
*
|
|
4
|
+
* Provides schema validation and issue detection for model.yaml files.
|
|
5
|
+
* This validation is triggered by the workspace manager when manifests are loaded.
|
|
6
|
+
*
|
|
7
|
+
* Validation includes:
|
|
8
|
+
* - Required fields for publishable packages
|
|
9
|
+
* - Dependency configuration correctness
|
|
10
|
+
* - Path alias validation
|
|
11
|
+
* - Version format validation
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
import type { ModelManifest } from '../services/types.js';
|
|
16
|
+
/**
|
|
17
|
+
* Severity levels for manifest diagnostics.
|
|
18
|
+
*/
|
|
19
|
+
export type ManifestSeverity = 'error' | 'warning' | 'info';
|
|
20
|
+
/**
|
|
21
|
+
* A diagnostic issue found in model.yaml.
|
|
22
|
+
*/
|
|
23
|
+
export interface ManifestDiagnostic {
|
|
24
|
+
/** Issue code for code action mapping */
|
|
25
|
+
readonly code: string;
|
|
26
|
+
/** Error severity */
|
|
27
|
+
readonly severity: ManifestSeverity;
|
|
28
|
+
/** Human-readable message */
|
|
29
|
+
readonly message: string;
|
|
30
|
+
/** YAML path to the issue (e.g., "dependencies.core.version") */
|
|
31
|
+
readonly path: string;
|
|
32
|
+
/** Optional hint for resolution */
|
|
33
|
+
readonly hint?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Result of manifest validation.
|
|
37
|
+
*/
|
|
38
|
+
export interface ManifestValidationResult {
|
|
39
|
+
/** Whether the manifest is valid (no errors) */
|
|
40
|
+
readonly valid: boolean;
|
|
41
|
+
/** All diagnostics found */
|
|
42
|
+
readonly diagnostics: ManifestDiagnostic[];
|
|
43
|
+
/** Count of errors only */
|
|
44
|
+
readonly errorCount: number;
|
|
45
|
+
/** Count of warnings only */
|
|
46
|
+
readonly warningCount: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Issue codes specific to manifest validation.
|
|
50
|
+
* These extend the general IssueCodes for manifest-specific issues.
|
|
51
|
+
*/
|
|
52
|
+
export declare const ManifestIssueCodes: {
|
|
53
|
+
readonly ModelMissingName: "manifest-model-missing-name";
|
|
54
|
+
readonly ModelMissingVersion: "manifest-model-missing-version";
|
|
55
|
+
readonly ModelInvalidVersion: "manifest-model-invalid-version";
|
|
56
|
+
readonly DependencyMissingRef: "manifest-dependency-missing-ref";
|
|
57
|
+
readonly DependencyInvalidRef: "manifest-dependency-invalid-ref";
|
|
58
|
+
readonly DependencyConflictingSourcePath: "manifest-dependency-conflicting-source-path";
|
|
59
|
+
readonly DependencyMissingSourceOrPath: "manifest-dependency-missing-source-or-path";
|
|
60
|
+
readonly DependencyInvalidSource: "manifest-dependency-invalid-source";
|
|
61
|
+
readonly DependencyAbsolutePath: "manifest-dependency-absolute-path";
|
|
62
|
+
readonly PathAliasMissingAtPrefix: "manifest-path-alias-missing-at-prefix";
|
|
63
|
+
readonly PathAliasAbsolutePath: "manifest-path-alias-absolute-path";
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Validates model.yaml manifests and reports issues.
|
|
67
|
+
*
|
|
68
|
+
* Usage:
|
|
69
|
+
* ```typescript
|
|
70
|
+
* const validator = new ManifestValidator();
|
|
71
|
+
* const result = validator.validate(manifest);
|
|
72
|
+
* if (!result.valid) {
|
|
73
|
+
* console.log(result.diagnostics);
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export declare class ManifestValidator {
|
|
78
|
+
/**
|
|
79
|
+
* Validates a parsed model.yaml manifest.
|
|
80
|
+
*
|
|
81
|
+
* @param manifest - The parsed manifest object
|
|
82
|
+
* @param options - Optional validation options
|
|
83
|
+
* @returns Validation result with diagnostics
|
|
84
|
+
*/
|
|
85
|
+
validate(manifest: ModelManifest, options?: {
|
|
86
|
+
requirePublishable?: boolean;
|
|
87
|
+
}): ManifestValidationResult;
|
|
88
|
+
/**
|
|
89
|
+
* Validates the model section of the manifest.
|
|
90
|
+
*/
|
|
91
|
+
private validateModelSection;
|
|
92
|
+
/**
|
|
93
|
+
* Validates the dependencies section of the manifest.
|
|
94
|
+
*/
|
|
95
|
+
private validateDependenciesSection;
|
|
96
|
+
/**
|
|
97
|
+
* Validates a single dependency entry.
|
|
98
|
+
*/
|
|
99
|
+
private validateDependency;
|
|
100
|
+
/**
|
|
101
|
+
* Validates a git-source based dependency.
|
|
102
|
+
*/
|
|
103
|
+
private validateSourceDependency;
|
|
104
|
+
/**
|
|
105
|
+
* Validates a path-based local dependency.
|
|
106
|
+
*/
|
|
107
|
+
private validatePathDependency;
|
|
108
|
+
/**
|
|
109
|
+
* Validates the paths section of the manifest.
|
|
110
|
+
*/
|
|
111
|
+
private validatePathsSection;
|
|
112
|
+
/**
|
|
113
|
+
* Normalizes a dependency to extended form.
|
|
114
|
+
*/
|
|
115
|
+
private normalizeDependency;
|
|
116
|
+
/**
|
|
117
|
+
* Checks if a version string is valid SemVer.
|
|
118
|
+
*/
|
|
119
|
+
private isValidSemVer;
|
|
120
|
+
/**
|
|
121
|
+
* Checks if a ref spec is valid (tag, branch, or commit SHA).
|
|
122
|
+
*/
|
|
123
|
+
private isValidRefSpec;
|
|
124
|
+
/**
|
|
125
|
+
* Checks if source is valid owner/repo format.
|
|
126
|
+
*/
|
|
127
|
+
private isValidSourceFormat;
|
|
128
|
+
/**
|
|
129
|
+
* Checks if a path is absolute.
|
|
130
|
+
*/
|
|
131
|
+
private isAbsolutePath;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Validates a manifest and returns true if valid, false otherwise.
|
|
135
|
+
* Use this for simple pass/fail checks.
|
|
136
|
+
*/
|
|
137
|
+
export declare function isManifestValid(manifest: ModelManifest): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Validates a manifest and returns all diagnostics.
|
|
140
|
+
* Use this to display validation errors to users.
|
|
141
|
+
*/
|
|
142
|
+
export declare function validateManifest(manifest: ModelManifest, options?: {
|
|
143
|
+
requirePublishable?: boolean;
|
|
144
|
+
}): ManifestDiagnostic[];
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manifest Validation for DomainLang.
|
|
3
|
+
*
|
|
4
|
+
* Provides schema validation and issue detection for model.yaml files.
|
|
5
|
+
* This validation is triggered by the workspace manager when manifests are loaded.
|
|
6
|
+
*
|
|
7
|
+
* Validation includes:
|
|
8
|
+
* - Required fields for publishable packages
|
|
9
|
+
* - Dependency configuration correctness
|
|
10
|
+
* - Path alias validation
|
|
11
|
+
* - Version format validation
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
import { IssueCodes } from './constants.js';
|
|
16
|
+
// ============================================================================
|
|
17
|
+
// Issue Code Mapping for Manifest Validation
|
|
18
|
+
// ============================================================================
|
|
19
|
+
/**
|
|
20
|
+
* Issue codes specific to manifest validation.
|
|
21
|
+
* These extend the general IssueCodes for manifest-specific issues.
|
|
22
|
+
*/
|
|
23
|
+
export const ManifestIssueCodes = {
|
|
24
|
+
// Model section issues
|
|
25
|
+
ModelMissingName: 'manifest-model-missing-name',
|
|
26
|
+
ModelMissingVersion: 'manifest-model-missing-version',
|
|
27
|
+
ModelInvalidVersion: 'manifest-model-invalid-version',
|
|
28
|
+
// Dependency section issues
|
|
29
|
+
DependencyMissingRef: 'manifest-dependency-missing-ref',
|
|
30
|
+
DependencyInvalidRef: 'manifest-dependency-invalid-ref',
|
|
31
|
+
DependencyConflictingSourcePath: 'manifest-dependency-conflicting-source-path',
|
|
32
|
+
DependencyMissingSourceOrPath: 'manifest-dependency-missing-source-or-path',
|
|
33
|
+
DependencyInvalidSource: 'manifest-dependency-invalid-source',
|
|
34
|
+
DependencyAbsolutePath: 'manifest-dependency-absolute-path',
|
|
35
|
+
// Path alias issues
|
|
36
|
+
PathAliasMissingAtPrefix: 'manifest-path-alias-missing-at-prefix',
|
|
37
|
+
PathAliasAbsolutePath: 'manifest-path-alias-absolute-path'
|
|
38
|
+
};
|
|
39
|
+
// ============================================================================
|
|
40
|
+
// Manifest Validator
|
|
41
|
+
// ============================================================================
|
|
42
|
+
/**
|
|
43
|
+
* Validates model.yaml manifests and reports issues.
|
|
44
|
+
*
|
|
45
|
+
* Usage:
|
|
46
|
+
* ```typescript
|
|
47
|
+
* const validator = new ManifestValidator();
|
|
48
|
+
* const result = validator.validate(manifest);
|
|
49
|
+
* if (!result.valid) {
|
|
50
|
+
* console.log(result.diagnostics);
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export class ManifestValidator {
|
|
55
|
+
/**
|
|
56
|
+
* Validates a parsed model.yaml manifest.
|
|
57
|
+
*
|
|
58
|
+
* @param manifest - The parsed manifest object
|
|
59
|
+
* @param options - Optional validation options
|
|
60
|
+
* @returns Validation result with diagnostics
|
|
61
|
+
*/
|
|
62
|
+
validate(manifest, options = {}) {
|
|
63
|
+
const diagnostics = [];
|
|
64
|
+
// Validate model section
|
|
65
|
+
this.validateModelSection(manifest, diagnostics, options.requirePublishable ?? false);
|
|
66
|
+
// Validate dependencies section
|
|
67
|
+
this.validateDependenciesSection(manifest, diagnostics);
|
|
68
|
+
// Validate paths section
|
|
69
|
+
this.validatePathsSection(manifest, diagnostics);
|
|
70
|
+
// Calculate counts
|
|
71
|
+
const errorCount = diagnostics.filter(d => d.severity === 'error').length;
|
|
72
|
+
const warningCount = diagnostics.filter(d => d.severity === 'warning').length;
|
|
73
|
+
return {
|
|
74
|
+
valid: errorCount === 0,
|
|
75
|
+
diagnostics,
|
|
76
|
+
errorCount,
|
|
77
|
+
warningCount
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Validates the model section of the manifest.
|
|
82
|
+
*/
|
|
83
|
+
validateModelSection(manifest, diagnostics, requirePublishable) {
|
|
84
|
+
const model = manifest.model;
|
|
85
|
+
// If no model section and not requiring publishable, that's OK
|
|
86
|
+
if (!model && !requirePublishable) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
// If requiring publishable package, name and version are required
|
|
90
|
+
if (requirePublishable) {
|
|
91
|
+
if (!model?.name) {
|
|
92
|
+
diagnostics.push({
|
|
93
|
+
code: ManifestIssueCodes.ModelMissingName,
|
|
94
|
+
severity: 'error',
|
|
95
|
+
message: 'Publishable packages require a model.name field.',
|
|
96
|
+
path: 'model.name',
|
|
97
|
+
hint: 'Add "name: my-package" under the model section.'
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
if (!model?.version) {
|
|
101
|
+
diagnostics.push({
|
|
102
|
+
code: ManifestIssueCodes.ModelMissingVersion,
|
|
103
|
+
severity: 'error',
|
|
104
|
+
message: 'Publishable packages require a model.version field.',
|
|
105
|
+
path: 'model.version',
|
|
106
|
+
hint: 'Add "version: 1.0.0" under the model section.'
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// Validate version format if present
|
|
111
|
+
if (model?.version && !this.isValidSemVer(model.version)) {
|
|
112
|
+
diagnostics.push({
|
|
113
|
+
code: ManifestIssueCodes.ModelInvalidVersion,
|
|
114
|
+
severity: 'warning',
|
|
115
|
+
message: `Version '${model.version}' is not valid SemVer format.`,
|
|
116
|
+
path: 'model.version',
|
|
117
|
+
hint: 'Use SemVer format like "1.0.0" or "1.2.3-beta".'
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Validates the dependencies section of the manifest.
|
|
123
|
+
*/
|
|
124
|
+
validateDependenciesSection(manifest, diagnostics) {
|
|
125
|
+
const dependencies = manifest.dependencies;
|
|
126
|
+
if (!dependencies) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
for (const [key, dep] of Object.entries(dependencies)) {
|
|
130
|
+
this.validateDependency(key, dep, diagnostics);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Validates a single dependency entry.
|
|
135
|
+
*/
|
|
136
|
+
validateDependency(key, dep, diagnostics) {
|
|
137
|
+
const normalized = this.normalizeDependency(key, dep);
|
|
138
|
+
const basePath = `dependencies.${key}`;
|
|
139
|
+
// Check for conflicting source and path
|
|
140
|
+
if (normalized.source && normalized.path) {
|
|
141
|
+
diagnostics.push({
|
|
142
|
+
code: IssueCodes.ImportConflictingSourcePath,
|
|
143
|
+
severity: 'error',
|
|
144
|
+
message: `Dependency '${key}' cannot have both 'source' and 'path'.`,
|
|
145
|
+
path: basePath,
|
|
146
|
+
hint: `Use 'source' for git packages or 'path' for local workspace packages.`
|
|
147
|
+
});
|
|
148
|
+
return; // Don't validate further if this fundamental issue exists
|
|
149
|
+
}
|
|
150
|
+
// Check that at least one of source or path is present
|
|
151
|
+
if (!normalized.source && !normalized.path) {
|
|
152
|
+
diagnostics.push({
|
|
153
|
+
code: IssueCodes.ImportMissingSourceOrPath,
|
|
154
|
+
severity: 'error',
|
|
155
|
+
message: `Dependency '${key}' must have either 'source' or 'path'.`,
|
|
156
|
+
path: basePath,
|
|
157
|
+
hint: `Add 'source: owner/repo' for git packages or 'path: ./local' for local packages.`
|
|
158
|
+
});
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
// Validate source-based dependencies
|
|
162
|
+
if (normalized.source) {
|
|
163
|
+
this.validateSourceDependency(key, normalized, basePath, diagnostics);
|
|
164
|
+
}
|
|
165
|
+
// Validate path-based dependencies
|
|
166
|
+
if (normalized.path) {
|
|
167
|
+
this.validatePathDependency(key, normalized, basePath, diagnostics);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Validates a git-source based dependency.
|
|
172
|
+
*/
|
|
173
|
+
validateSourceDependency(key, dep, basePath, diagnostics) {
|
|
174
|
+
// Source dependencies require a ref (tag, branch, or commit)
|
|
175
|
+
if (!dep.ref) {
|
|
176
|
+
diagnostics.push({
|
|
177
|
+
code: IssueCodes.ImportMissingRef,
|
|
178
|
+
severity: 'error',
|
|
179
|
+
message: `Git dependency '${key}' requires a ref.`,
|
|
180
|
+
path: `${basePath}.ref`,
|
|
181
|
+
hint: `Add a git ref: 'ref: v1.0.0' (tag), 'ref: main' (branch), or a commit SHA.`
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
// Validate ref format
|
|
185
|
+
if (dep.ref && !this.isValidRefSpec(dep.ref)) {
|
|
186
|
+
diagnostics.push({
|
|
187
|
+
code: ManifestIssueCodes.DependencyInvalidRef,
|
|
188
|
+
severity: 'warning',
|
|
189
|
+
message: `Ref '${dep.ref}' for '${key}' may be invalid.`,
|
|
190
|
+
path: `${basePath}.ref`,
|
|
191
|
+
hint: `Use a tag (v1.0.0), branch name (main), or commit SHA.`
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
// Validate source format (should be owner/repo)
|
|
195
|
+
if (dep.source && !this.isValidSourceFormat(dep.source)) {
|
|
196
|
+
diagnostics.push({
|
|
197
|
+
code: ManifestIssueCodes.DependencyInvalidSource,
|
|
198
|
+
severity: 'error',
|
|
199
|
+
message: `Source '${dep.source}' is not valid owner/repo format.`,
|
|
200
|
+
path: `${basePath}.source`,
|
|
201
|
+
hint: `Use format 'owner/repo' like 'domainlang/core'.`
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Validates a path-based local dependency.
|
|
207
|
+
*/
|
|
208
|
+
validatePathDependency(key, dep, basePath, diagnostics) {
|
|
209
|
+
// Path dependencies should use relative paths
|
|
210
|
+
if (dep.path && this.isAbsolutePath(dep.path)) {
|
|
211
|
+
diagnostics.push({
|
|
212
|
+
code: IssueCodes.ImportAbsolutePath,
|
|
213
|
+
severity: 'error',
|
|
214
|
+
message: `Local path '${dep.path}' for '${key}' must be relative.`,
|
|
215
|
+
path: `${basePath}.path`,
|
|
216
|
+
hint: `Use a relative path like './packages/shared'.`
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Validates the paths section of the manifest.
|
|
222
|
+
*/
|
|
223
|
+
validatePathsSection(manifest, diagnostics) {
|
|
224
|
+
const paths = manifest.paths;
|
|
225
|
+
if (!paths) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
for (const [alias, targetPath] of Object.entries(paths)) {
|
|
229
|
+
// Path aliases should start with @
|
|
230
|
+
if (!alias.startsWith('@')) {
|
|
231
|
+
diagnostics.push({
|
|
232
|
+
code: ManifestIssueCodes.PathAliasMissingAtPrefix,
|
|
233
|
+
severity: 'warning',
|
|
234
|
+
message: `Path alias '${alias}' should start with '@'.`,
|
|
235
|
+
path: `paths.${alias}`,
|
|
236
|
+
hint: `Rename to '@${alias}' for consistency.`
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
// Target paths should be relative
|
|
240
|
+
if (this.isAbsolutePath(targetPath)) {
|
|
241
|
+
diagnostics.push({
|
|
242
|
+
code: ManifestIssueCodes.PathAliasAbsolutePath,
|
|
243
|
+
severity: 'error',
|
|
244
|
+
message: `Path alias '${alias}' cannot map to absolute path '${targetPath}'.`,
|
|
245
|
+
path: `paths.${alias}`,
|
|
246
|
+
hint: `Use a relative path like './src' or '.'`
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
// ========================================================================
|
|
252
|
+
// Helpers
|
|
253
|
+
// ========================================================================
|
|
254
|
+
/**
|
|
255
|
+
* Normalizes a dependency to extended form.
|
|
256
|
+
*/
|
|
257
|
+
normalizeDependency(key, dep) {
|
|
258
|
+
if (typeof dep === 'string') {
|
|
259
|
+
return { source: key, ref: dep };
|
|
260
|
+
}
|
|
261
|
+
if (dep.source || dep.path) {
|
|
262
|
+
return dep;
|
|
263
|
+
}
|
|
264
|
+
return { ...dep, source: key };
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Checks if a version string is valid SemVer.
|
|
268
|
+
*/
|
|
269
|
+
isValidSemVer(version) {
|
|
270
|
+
const semverRegex = /^\d+\.\d+\.\d+(-[\w.]+)?(\+[\w.]+)?$/;
|
|
271
|
+
return semverRegex.test(version);
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Checks if a ref spec is valid (tag, branch, or commit SHA).
|
|
275
|
+
*/
|
|
276
|
+
isValidRefSpec(ref) {
|
|
277
|
+
// SemVer with optional v prefix (tags)
|
|
278
|
+
if (/^v?\d+\.\d+\.\d+/.test(ref)) {
|
|
279
|
+
return true;
|
|
280
|
+
}
|
|
281
|
+
// Branch names (simple word chars)
|
|
282
|
+
if (/^[\w][\w.-]*$/.test(ref)) {
|
|
283
|
+
return true;
|
|
284
|
+
}
|
|
285
|
+
// Commit SHAs (40 hex chars)
|
|
286
|
+
if (/^[0-9a-f]{40}$/i.test(ref)) {
|
|
287
|
+
return true;
|
|
288
|
+
}
|
|
289
|
+
// Short commit SHAs (7+ hex chars)
|
|
290
|
+
if (/^[0-9a-f]{7,}$/i.test(ref)) {
|
|
291
|
+
return true;
|
|
292
|
+
}
|
|
293
|
+
return false;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Checks if source is valid owner/repo format.
|
|
297
|
+
*/
|
|
298
|
+
isValidSourceFormat(source) {
|
|
299
|
+
return /^[a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+$/.test(source);
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Checks if a path is absolute.
|
|
303
|
+
*/
|
|
304
|
+
isAbsolutePath(p) {
|
|
305
|
+
return p.startsWith('/') || /^[A-Za-z]:/.test(p);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
// ============================================================================
|
|
309
|
+
// Convenience Functions
|
|
310
|
+
// ============================================================================
|
|
311
|
+
/**
|
|
312
|
+
* Validates a manifest and returns true if valid, false otherwise.
|
|
313
|
+
* Use this for simple pass/fail checks.
|
|
314
|
+
*/
|
|
315
|
+
export function isManifestValid(manifest) {
|
|
316
|
+
const validator = new ManifestValidator();
|
|
317
|
+
return validator.validate(manifest).valid;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Validates a manifest and returns all diagnostics.
|
|
321
|
+
* Use this to display validation errors to users.
|
|
322
|
+
*/
|
|
323
|
+
export function validateManifest(manifest, options) {
|
|
324
|
+
const validator = new ManifestValidator();
|
|
325
|
+
return validator.validate(manifest, options).diagnostics;
|
|
326
|
+
}
|
|
327
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../src/validation/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAyC5C,+EAA+E;AAC/E,6CAA6C;AAC7C,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAC9B,uBAAuB;IACvB,gBAAgB,EAAE,6BAA6B;IAC/C,mBAAmB,EAAE,gCAAgC;IACrD,mBAAmB,EAAE,gCAAgC;IAErD,4BAA4B;IAC5B,oBAAoB,EAAE,iCAAiC;IACvD,oBAAoB,EAAE,iCAAiC;IACvD,+BAA+B,EAAE,6CAA6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OAEG;IACK,cAAc,CAAC,CAAS;QAC5B,OAAO,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACrD,CAAC;CACJ;AAED,+EAA+E;AAC/E,wBAAwB;AACxB,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,QAAuB;IACnD,MAAM,SAAS,GAAG,IAAI,iBAAiB,EAAE,CAAC;IAC1C,OAAO,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC;AAC9C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAC5B,QAAuB,EACvB,OAA0C;IAE1C,MAAM,SAAS,GAAG,IAAI,iBAAiB,EAAE,CAAC;IAC1C,OAAO,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,WAAW,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ValidationAcceptor } from 'langium';
|
|
2
|
+
import type { ContextMap, DomainMap } from '../generated/ast.js';
|
|
3
|
+
/**
|
|
4
|
+
* Validates that a context map contains at least one bounded context.
|
|
5
|
+
* Empty context maps are not useful for documentation purposes.
|
|
6
|
+
*
|
|
7
|
+
* @param map - The context map to validate
|
|
8
|
+
* @param accept - The validation acceptor for reporting issues
|
|
9
|
+
*/
|
|
10
|
+
declare function validateContextMapHasContexts(map: ContextMap, accept: ValidationAcceptor): void;
|
|
11
|
+
/**
|
|
12
|
+
* Validates that a domain map contains at least one domain.
|
|
13
|
+
* Empty domain maps are not useful for documentation purposes.
|
|
14
|
+
*
|
|
15
|
+
* @param map - The domain map to validate
|
|
16
|
+
* @param accept - The validation acceptor for reporting issues
|
|
17
|
+
*/
|
|
18
|
+
declare function validateDomainMapHasDomains(map: DomainMap, accept: ValidationAcceptor): void;
|
|
19
|
+
export declare const contextMapChecks: (typeof validateContextMapHasContexts)[];
|
|
20
|
+
export declare const domainMapChecks: (typeof validateDomainMapHasDomains)[];
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ValidationMessages, buildCodeDescription } from './constants.js';
|
|
2
|
+
/**
|
|
3
|
+
* Validates that a context map contains at least one bounded context.
|
|
4
|
+
* Empty context maps are not useful for documentation purposes.
|
|
5
|
+
*
|
|
6
|
+
* @param map - The context map to validate
|
|
7
|
+
* @param accept - The validation acceptor for reporting issues
|
|
8
|
+
*/
|
|
9
|
+
function validateContextMapHasContexts(map, accept) {
|
|
10
|
+
if (!map.boundedContexts || map.boundedContexts.length === 0) {
|
|
11
|
+
accept('warning', ValidationMessages.CONTEXT_MAP_NO_CONTEXTS(map.name), {
|
|
12
|
+
node: map,
|
|
13
|
+
keyword: 'contains',
|
|
14
|
+
codeDescription: buildCodeDescription('language.md', 'context-maps')
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Validates that a context map has at least one relationship if it contains multiple contexts.
|
|
20
|
+
* Multiple unrelated contexts should have documented relationships.
|
|
21
|
+
*
|
|
22
|
+
* @param map - The context map to validate
|
|
23
|
+
* @param accept - The validation acceptor for reporting issues
|
|
24
|
+
*/
|
|
25
|
+
function validateContextMapHasRelationships(map, accept) {
|
|
26
|
+
const contextCount = map.boundedContexts?.length ?? 0;
|
|
27
|
+
const relationshipCount = map.relationships?.length ?? 0;
|
|
28
|
+
// Only warn if multiple contexts exist without relationships
|
|
29
|
+
if (contextCount > 1 && relationshipCount === 0) {
|
|
30
|
+
accept('info', ValidationMessages.CONTEXT_MAP_NO_RELATIONSHIPS(map.name, contextCount), {
|
|
31
|
+
node: map,
|
|
32
|
+
keyword: 'ContextMap',
|
|
33
|
+
codeDescription: buildCodeDescription('language.md', 'context-maps')
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Validates that a domain map contains at least one domain.
|
|
39
|
+
* Empty domain maps are not useful for documentation purposes.
|
|
40
|
+
*
|
|
41
|
+
* @param map - The domain map to validate
|
|
42
|
+
* @param accept - The validation acceptor for reporting issues
|
|
43
|
+
*/
|
|
44
|
+
function validateDomainMapHasDomains(map, accept) {
|
|
45
|
+
if (!map.domains || map.domains.length === 0) {
|
|
46
|
+
accept('warning', ValidationMessages.DOMAIN_MAP_NO_DOMAINS(map.name), {
|
|
47
|
+
node: map,
|
|
48
|
+
keyword: 'contains',
|
|
49
|
+
codeDescription: buildCodeDescription('language.md', 'domain-maps')
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export const contextMapChecks = [
|
|
54
|
+
validateContextMapHasContexts,
|
|
55
|
+
validateContextMapHasRelationships
|
|
56
|
+
];
|
|
57
|
+
export const domainMapChecks = [
|
|
58
|
+
validateDomainMapHasDomains
|
|
59
|
+
];
|
|
60
|
+
//# sourceMappingURL=maps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maps.js","sourceRoot":"","sources":["../../src/validation/maps.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE1E;;;;;;GAMG;AACH,SAAS,6BAA6B,CAClC,GAAe,EACf,MAA0B;IAE1B,IAAI,CAAC,GAAG,CAAC,eAAe,IAAI,GAAG,CAAC,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3D,MAAM,CAAC,SAAS,EAAE,kBAAkB,CAAC,uBAAuB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YACpE,IAAI,EAAE,GAAG;YACT,OAAO,EAAE,UAAU;YACnB,eAAe,EAAE,oBAAoB,CAAC,aAAa,EAAE,cAAc,CAAC;SACvE,CAAC,CAAC;IACP,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,SAAS,kCAAkC,CACvC,GAAe,EACf,MAA0B;IAE1B,MAAM,YAAY,GAAG,GAAG,CAAC,eAAe,EAAE,MAAM,IAAI,CAAC,CAAC;IACtD,MAAM,iBAAiB,GAAG,GAAG,CAAC,aAAa,EAAE,MAAM,IAAI,CAAC,CAAC;IAEzD,6DAA6D;IAC7D,IAAI,YAAY,GAAG,CAAC,IAAI,iBAAiB,KAAK,CAAC,EAAE,CAAC;QAC9C,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,4BAA4B,CAAC,GAAG,CAAC,IAAI,EAAE,YAAY,CAAC,EAAE;YACpF,IAAI,EAAE,GAAG;YACT,OAAO,EAAE,YAAY;YACrB,eAAe,EAAE,oBAAoB,CAAC,aAAa,EAAE,cAAc,CAAC;SACvE,CAAC,CAAC;IACP,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,SAAS,2BAA2B,CAChC,GAAc,EACd,MAA0B;IAE1B,IAAI,CAAC,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3C,MAAM,CAAC,SAAS,EAAE,kBAAkB,CAAC,qBAAqB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAClE,IAAI,EAAE,GAAG;YACT,OAAO,EAAE,UAAU;YACnB,eAAe,EAAE,oBAAoB,CAAC,aAAa,EAAE,aAAa,CAAC;SACtE,CAAC,CAAC;IACP,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC5B,6BAA6B;IAC7B,kCAAkC;CACrC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG;IAC3B,2BAA2B;CAC9B,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ValidationChecks } from 'langium';
|
|
2
|
+
import type { DomainLangAstType } from '../generated/ast.js';
|
|
3
|
+
/**
|
|
4
|
+
* Validation checks for Metadata elements.
|
|
5
|
+
* - Ensures metadata keys are defined before use
|
|
6
|
+
*/
|
|
7
|
+
export declare const metadataChecks: ValidationChecks<DomainLangAstType>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ValidationMessages, buildCodeDescription } from './constants.js';
|
|
2
|
+
/**
|
|
3
|
+
* Validation checks for Metadata elements.
|
|
4
|
+
* - Ensures metadata keys are defined before use
|
|
5
|
+
*/
|
|
6
|
+
export const metadataChecks = {
|
|
7
|
+
Metadata(metadata, accept) {
|
|
8
|
+
if (!metadata.name) {
|
|
9
|
+
accept('error', ValidationMessages.METADATA_MISSING_NAME(), {
|
|
10
|
+
node: metadata,
|
|
11
|
+
codeDescription: buildCodeDescription('language.md', 'metadata')
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../src/validation/metadata.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE1E;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAwC;IAC/D,QAAQ,CAAC,QAAkB,EAAE,MAAM;QAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;YACjB,MAAM,CAAC,OAAO,EAAE,kBAAkB,CAAC,qBAAqB,EAAE,EAAE;gBACxD,IAAI,EAAE,QAAQ;gBACd,eAAe,EAAE,oBAAoB,CAAC,aAAa,EAAE,UAAU,CAAC;aACnE,CAAC,CAAC;QACP,CAAC;IACL,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ValidationAcceptor } from 'langium';
|
|
2
|
+
import type { Model } from '../generated/ast.js';
|
|
3
|
+
/**
|
|
4
|
+
* Validates that all elements in the model have unique fully qualified names.
|
|
5
|
+
* Also triggers relationship type inference.
|
|
6
|
+
*
|
|
7
|
+
* @param model - The model to validate
|
|
8
|
+
* @param accept - The validation acceptor for reporting issues
|
|
9
|
+
*/
|
|
10
|
+
declare function validateModelUniqueNames(model: Model, accept: ValidationAcceptor): void;
|
|
11
|
+
export declare const modelChecks: (typeof validateModelUniqueNames)[];
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { setInferredRelationshipTypes } from '../services/relationship-inference.js';
|
|
2
|
+
import { extractNames } from './shared.js';
|
|
3
|
+
import { ValidationMessages, buildCodeDescription } from './constants.js';
|
|
4
|
+
/**
|
|
5
|
+
* Validates that all elements in the model have unique fully qualified names.
|
|
6
|
+
* Also triggers relationship type inference.
|
|
7
|
+
*
|
|
8
|
+
* @param model - The model to validate
|
|
9
|
+
* @param accept - The validation acceptor for reporting issues
|
|
10
|
+
*/
|
|
11
|
+
function validateModelUniqueNames(model, accept) {
|
|
12
|
+
const uniqueNames = new Set();
|
|
13
|
+
const names = extractNames(model);
|
|
14
|
+
for (const { fqn, node } of names) {
|
|
15
|
+
const oldSize = uniqueNames.size;
|
|
16
|
+
uniqueNames.add(fqn);
|
|
17
|
+
if (uniqueNames.size === oldSize) {
|
|
18
|
+
accept('error', ValidationMessages.DUPLICATE_ELEMENT(fqn), {
|
|
19
|
+
node: node,
|
|
20
|
+
property: 'name',
|
|
21
|
+
codeDescription: buildCodeDescription('language.md', 'naming')
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
// Enrich relationships with inferred types
|
|
26
|
+
setInferredRelationshipTypes(model);
|
|
27
|
+
}
|
|
28
|
+
export const modelChecks = [validateModelUniqueNames];
|
|
29
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/validation/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE1E;;;;;;GAMG;AACH,SAAS,wBAAwB,CAC7B,KAAY,EACZ,MAA0B;IAE1B,MAAM,WAAW,GAAG,IAAI,GAAG,EAAU,CAAC;IACtC,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IAElC,KAAK,MAAM,EAAC,GAAG,EAAE,IAAI,EAAC,IAAI,KAAK,EAAE,CAAC;QAC9B,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC;QACjC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACrB,IAAI,WAAW,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC/B,MAAM,CAAC,OAAO,EAAE,kBAAkB,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE;gBACvD,IAAI,EAAE,IAAI;gBACV,QAAQ,EAAE,MAAM;gBAChB,eAAe,EAAE,oBAAoB,CAAC,aAAa,EAAE,QAAQ,CAAC;aACjE,CAAC,CAAC;QACP,CAAC;IACL,CAAC;IAED,2CAA2C;IAC3C,4BAA4B,CAAC,KAAK,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,wBAAwB,CAAC,CAAC"}
|