forked from SAP/xml-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.d.ts
36 lines (33 loc) · 1022 Bytes
/
api.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import {
XMLAstNode,
XMLAttribute,
XMLElement,
XMLDocument,
} from "@xml-tools/ast";
declare type AttributeValidator = (node: XMLAttribute) => ValidationIssue[];
declare type ElementValidator = (node: XMLElement) => ValidationIssue[];
declare function validate(options: {
doc: XMLDocument;
validators: {
attribute?: AttributeValidator[];
element?: ElementValidator[];
};
}): ValidationIssue[];
interface ValidationIssue {
msg: string;
/**
* ASTNode where the issue occurred.
*/
node: XMLAstNode;
/**
* The Severity is optional as that may need to be determined outside
* the validation logic, For example in an IDE's inspections configuration.
*/
severity?: "info" | "warning" | "error";
/**
* Optional property to indicate a more specific error location.
* For example: For Missing Attribute error in an element we may want to
* only mark the Element **Name** area instead of the whole element.
*/
position?: { startOffset: number; endOffset: number };
}