@domorium/validator 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,47 @@
2
2
 
3
3
  All notable changes to `@domorium/validator` are documented here.
4
4
 
5
+ ## 1.5.0 - 2026-08-10
6
+
7
+ - **The GEDCOM version is resolved against a table by longest match, and a
8
+ version we hold no schema for no longer validates against the newest one.**
9
+ `2 VERS 4.0`, a garbage version and a document with no `VERS` line were all
10
+ checked against GEDCOM 7 and reported clean, because nothing they were checked
11
+ against applied to them. Three codes replace that silence: `VAL011` for a
12
+ version no schema describes, `VAL012` for a document whose version cannot be
13
+ read, `VAL013` for one checked against another version's schema. The first two
14
+ suppress every schema-derived diagnostic, while lexing, tree assembly and
15
+ level validation still run — a 4.0 file with a level that cannot follow the
16
+ line above it still says so. `5.5`, `5.5.5` and `5.5 EL` are checked against
17
+ the 5.5.1 schema with a warning naming the substitution; `5.6`, `5.4`, `5.3`,
18
+ `5.0` and `4` are not, because the difference runs the wrong way and the
19
+ substitution would report false errors on correct lines.
20
+ - **A structure the specification gives no substructures accepted any child.**
21
+ `getRules` answered `undefined` both for a leaf and for a type it could not
22
+ resolve, and the permissive reading of the two won: 57 structures in GEDCOM 7
23
+ and 89 in 5.5.1 accepted anything at all, `TRLR` among them in 5.5.1. So
24
+
25
+ 0 @S1@ SOUR
26
+ 1 TITL Open Archieven
27
+ 2 BOGUS whatever
28
+
29
+ reported nothing. A child of a leaf structure is now an unknown tag.
30
+
31
+ - `2 VERS 5.5.1`, with more than one space after the tag, selected the GEDCOM 7
32
+ schema and the file came back clean. The delimiter after a tag belongs to the
33
+ payload, so the version is trimmed before it selects anything. Present since
34
+ 1.2.0.
35
+ - The inline form of a 5.5.1 multimedia link was unreachable, so `1 OBJE` with
36
+ `FILE` and `TITL` written beneath it reported `FILE` as an unknown tag. Both
37
+ shapes now resolve. One type serves both, so a pointer carrying children and an
38
+ inline form with only a `TITL` are accepted where the specification allows
39
+ neither; telling them apart needs a schema that can offer two types for one
40
+ tag.
41
+ - New on `GedcomDocument`: `getVersionResolution()` returns the outcome above
42
+ without parsing a message, and `getDialect()` names the version whose rules
43
+ apply — or nothing, for a version we cannot judge. `VersionResolution` and
44
+ `GedcomDialect` are exported alongside them.
45
+
5
46
  ## 1.4.0 - 2026-08-09
6
47
 
7
48
  - Read a `HEAD.SCHMA` tag whose URI is a standard one as the structure it names.
@@ -1,5 +1,6 @@
1
1
  import { GedcomError } from "../types/errors";
2
2
  import { ASTNode, ASTToken } from "../parser";
3
+ import { type GedcomDialect, type VersionResolution } from "../validator/versionRegistry";
3
4
  import { type GedcomCompletion } from "../completion/completion";
4
5
  import type { Position } from "../types/position";
5
6
  export declare class GedcomDocument {
@@ -8,6 +9,8 @@ export declare class GedcomDocument {
8
9
  xRefs: Map<string, ASTToken[]>;
9
10
  private errors;
10
11
  private scheme;
12
+ private resolution;
13
+ private requiresSchmaDeclaration;
11
14
  private extensions;
12
15
  private parseGedcom;
13
16
  createDocument(text: string): GedcomDocument;
@@ -16,6 +19,8 @@ export declare class GedcomDocument {
16
19
  getPointerTargetTag(node: ASTNode): string | undefined;
17
20
  isRecordDeclaration(node: ASTNode): boolean;
18
21
  getVersion(): string | undefined;
22
+ getVersionResolution(): VersionResolution | undefined;
23
+ getDialect(): GedcomDialect | undefined;
19
24
  getCompletions(position: Position, lineText: string): GedcomCompletion[];
20
25
  updateDocument(_text: string, _range: Range): GedcomDocument;
21
26
  getErrors(_lang?: string): GedcomError[];