forked from SAP/ui5-language-assistant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.d.ts
130 lines (105 loc) · 4.22 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import { XMLDocument, XMLElement, XMLAttribute } from "@xml-tools/ast";
import { OffsetRange } from "@ui5-language-assistant/logic-utils";
import { UI5ValidatorsConfig } from "./src/validate-xml-views";
import { Context } from "@ui5-language-assistant/context";
export function validateXMLView(opts: {
validators: UI5ValidatorsConfig;
context: Context;
xmlView: XMLDocument;
}): UI5XMLViewIssue[];
export declare const defaultValidators: UI5ValidatorsConfig;
export type XMLViewIssueSeverity = "hint" | "info" | "warn" | "error";
export interface BaseUI5XMLViewIssue {
kind: string;
message: string;
severity: XMLViewIssueSeverity;
offsetRange: OffsetRange;
}
export type UseOfDeprecatedAttributeIssue =
| UseOfDeprecatedPropertyIssue
| UseOfDeprecatedAggregationIssue
| UseOfDeprecatedEventIssue
| UseOfDeprecatedAssociationIssue;
export type UI5XMLViewIssue =
| UnknownEnumValueIssue
| UseOfDeprecatedClassIssue
| UseOfDeprecatedAggregationIssue
| UseOfDeprecatedPropertyIssue
| UseOfDeprecatedEventIssue
| UseOfDeprecatedAssociationIssue
| UnknownNamespaceInXmlnsAttributeValueIssue
| InvalidBooleanValueIssue
| NonUniqueIDIssue
| NonStableIDIssue
| UnknownAttributeKeyIssue
| UnknownTagNameIssue
| InvalidAggregationCardinalityIssue
| InvalidAggregationTypeIssue;
// A sub-interface per issue type may seem redundant, but this allows
// a sub-issue type to have additional properties (if needed) in the future.
export interface UnknownEnumValueIssue extends BaseUI5XMLViewIssue {
kind: "UnknownEnumValue";
}
export interface UseOfDeprecatedClassIssue extends BaseUI5XMLViewIssue {
kind: "UseOfDeprecatedClass";
}
export interface UseOfDeprecatedAggregationIssue extends BaseUI5XMLViewIssue {
kind: "UseOfDeprecatedAggregation";
}
export interface UseOfDeprecatedPropertyIssue extends BaseUI5XMLViewIssue {
kind: "UseOfDeprecatedProperty";
}
export interface UseOfDeprecatedEventIssue extends BaseUI5XMLViewIssue {
kind: "UseOfDeprecatedEvent";
}
export interface UseOfDeprecatedAssociationIssue extends BaseUI5XMLViewIssue {
kind: "UseOfDeprecatedAssociation";
}
export interface InvalidAggregationCardinalityIssue
extends BaseUI5XMLViewIssue {
kind: "InvalidAggregationCardinality";
}
export interface InvalidAggregationTypeIssue extends BaseUI5XMLViewIssue {
kind: "InvalidAggregationType";
}
export interface UnknownNamespaceInXmlnsAttributeValueIssue
extends BaseUI5XMLViewIssue {
kind: "UnknownNamespaceInXmlnsAttributeValue";
}
export interface UnknownAttributeKeyIssue extends BaseUI5XMLViewIssue {
kind: "UnknownAttributeKey";
}
export interface UnknownTagNameIssue extends BaseUI5XMLViewIssue {
kind: "UnknownTagName";
}
export interface InvalidBooleanValueIssue extends BaseUI5XMLViewIssue {
kind: "InvalidBooleanValue";
}
export interface NonUniqueIDIssue extends BaseUI5XMLViewIssue {
kind: "NonUniqueIDIssue";
identicalIDsRanges: OffsetRange[];
}
export interface NonStableIDIssue extends BaseUI5XMLViewIssue {
kind: "NonStableIDIssue";
}
type XMLAttributeValidator<T> = (
attribute: XMLAttribute,
context: Context
) => T[];
type XMLDocumentValidator<T> = (document: XMLDocument) => T[];
type XMLElementValidator<T> = (XMLElement: XMLElement, context: Context) => T[];
type Validators = {
validateUnknownEnumValue: XMLAttributeValidator<UnknownEnumValueIssue>;
validateUnknownXmlnsNamespace: XMLAttributeValidator<UnknownNamespaceInXmlnsAttributeValueIssue>;
validateBooleanValue: XMLAttributeValidator<InvalidBooleanValueIssue>;
validateUseOfDeprecatedAttribute: XMLAttributeValidator<UseOfDeprecatedAttributeIssue>;
validateUnknownAttributeKey: XMLAttributeValidator<UnknownAttributeKeyIssue>;
validateNonUniqueID: XMLDocumentValidator<NonUniqueIDIssue>;
validateUseOfDeprecatedAggregation: XMLElementValidator<UseOfDeprecatedAggregationIssue>;
validateUseOfDeprecatedClass: XMLElementValidator<UseOfDeprecatedClassIssue>;
validateUnknownTagName: XMLElementValidator<UnknownTagNameIssue>;
validateExplicitAggregationCardinality: XMLElementValidator<InvalidAggregationCardinalityIssue>;
validateAggregationType: XMLElementValidator<InvalidAggregationTypeIssue>;
validateNonStableId: XMLElementValidator<NonStableIDIssue>;
};
export const validators: Validators;