/
RuleSuppressionSet.ts
73 lines (66 loc) · 3.37 KB
/
RuleSuppressionSet.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
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
* @module Validation
*/
import { AnyClass, AnyECType, AnyProperty, Constant, CustomAttribute, CustomAttributeClass,
CustomAttributeContainerProps, EntityClass, Enumeration, Format, InvertedUnit, KindOfQuantity, Mixin, Phenomenon,
PropertyCategory, RelationshipClass, RelationshipConstraint, Schema, SchemaItem, StructClass, Unit,
UnitSystem } from "@itwin/ecschema-metadata";
import { AnyDiagnostic } from "./Diagnostic";
/**
* Interface used for all rule suppressions used during schema validation.
* Just telling us whether a rule is suppressed or not.
* @beta
*/
export type ISuppressionRule<T extends AnyECType, U = {}> = (diagnostic: AnyDiagnostic, ecDefinition: T, ...args: U[]) => Promise<boolean>;
/** @beta */
export type BaseSuppressionRule<T extends AnyECType, U extends AnyECType> = ISuppressionRule<T, U>;
/** @internal */
export type AnyRuleSuppressionMap = IRuleSuppressionMap<AnyECType>;
/**
* Interface used to represent elements of a rule suppression
* @beta
*/
export interface IRuleSuppressionMap<T extends AnyECType, U = {}> {
ruleCode: string;
rule: ISuppressionRule<T, U>;
}
/**
* Interface used to represent elements of a rule suppression
* @beta
*/
export interface BaseRuleSuppressionMap<T extends AnyECType, U extends AnyECType> {
ruleCode: string;
rule: BaseSuppressionRule<T, U>;
}
/**
* Interface used to represent logical collection of [[ISuppressionRule]] instances.
* @beta
*/
export interface IRuleSuppressionSet {
name: string;
schemaRuleSuppressions?: Array<IRuleSuppressionMap<Schema>>;
schemaItemRuleSuppressions?: Array<IRuleSuppressionMap<SchemaItem>>;
classRuleSuppressions?: Array<IRuleSuppressionMap<AnyClass>>;
propertyRuleSuppressions?: Array<IRuleSuppressionMap<AnyProperty>>;
entityRuleSuppressions?: Array<IRuleSuppressionMap<EntityClass>>;
structRuleSuppressions?: Array<IRuleSuppressionMap<StructClass>>;
mixinRuleSuppressions?: Array<IRuleSuppressionMap<Mixin>>;
relationshipRuleSuppressions?: Array<IRuleSuppressionMap<RelationshipClass>>;
relationshipConstraintRuleSuppressions?: Array<IRuleSuppressionMap<RelationshipConstraint>>;
customAttributeRuleSuppressions?: Array<IRuleSuppressionMap<CustomAttributeClass>>;
customAttributeContainerSuppressions?: Array<IRuleSuppressionMap<CustomAttributeContainerProps>>;
customAttributeInstanceSuppressions?: Array<BaseRuleSuppressionMap<CustomAttributeContainerProps, CustomAttribute>>;
enumerationRuleSuppressions?: Array<IRuleSuppressionMap<Enumeration>>;
koqRuleSuppressions?: Array<IRuleSuppressionMap<KindOfQuantity>>;
propertyCategoryRuleSuppressions?: Array<IRuleSuppressionMap<PropertyCategory>>;
formatRuleSuppressions?: Array<IRuleSuppressionMap<Format>>;
unitRuleSuppressions?: Array<IRuleSuppressionMap<Unit>>;
invertedUnitRuleSuppressions?: Array<IRuleSuppressionMap<InvertedUnit>>;
unitSystemRuleSuppressions?: Array<IRuleSuppressionMap<UnitSystem>>;
phenomenonRuleSuppressions?: Array<IRuleSuppressionMap<Phenomenon>>;
constantRuleSuppressions?: Array<IRuleSuppressionMap<Constant>>;
}