/** @packageDocumentation * @module Validation */ import { AnyClass, AnyProperty, CustomAttribute, CustomAttributeContainerProps, EntityClass, Enumeration, RelationshipClass, RelationshipConstraint, Schema } from "@itwin/ecschema-metadata"; import { ClassDiagnostic, CustomAttributeContainerDiagnostic, DiagnosticType, PropertyDiagnostic, RelationshipConstraintDiagnostic, SchemaDiagnostic, SchemaItemDiagnostic } from "./Diagnostic"; import { IRuleSet } from "./Rules"; /** * The unique diagnostic codes for ECObjects rules. * * To provide meaning to code values, with anticipation * of future rules for all current EC Types, the following * value ranges should be used: * * - Schema: 000-099 * - Class: 100-199 * - Constant: 200-299 * - CustomAttribute 300-399 * - CustomAttributeClass: 400-499 * - CustomAttributeContainer: 500-599 * - EntityClass: 600-699 * - Enumeration: 700-799 * - Format: 800-899 * - InvertedUnit: 900-999 * - KindOfQuantity: 1000-1099 * - Mixin: 1100-1199 * - Phenomenon: 1200-1299 * - Property: 1300-1399 * - PropertyCategory: 1400-1499 * - RelationshipClass: 1500-1599 * - RelationshipConstraint: 1600-1699 * - StructClass: 1700-1799 * - Unit: 1800-1899 * - UnitSystem: 1900-1999 * @beta */ export declare const DiagnosticCodes: { BaseClassIsSealed: string; BaseClassOfDifferentType: string; AbstractClassWithNonAbstractBase: string; CustomAttributeNotOfConcreteClass: string; CustomAttributeSchemaMustBeReferenced: string; CustomAttributeClassNotFound: string; EnumerationTypeUnsupported: string; MixinAppliedToClassMustDeriveFromConstraint: string; IncompatibleValueTypePropertyOverride: string; IncompatibleTypePropertyOverride: string; IncompatibleUnitPropertyOverride: string; AbstractConstraintMustNarrowBaseConstraints: string; DerivedConstraintsMustNarrowBaseConstraints: string; ConstraintClassesDeriveFromAbstractConstraint: string; AtLeastOneConstraintClassDefined: string; AbstractConstraintMustExistWithMultipleConstraints: string; NonPolymorphicConstraintMustBeConcrete: string; }; /** * The list of [[IDiagnostic]] implementation classes used by the EC rule implementations. * @beta */ export declare const Diagnostics: { /** EC-001: Required message parameters: schema name, referenced schema name */ SupplementalSchemasCannotBeReferenced: { new (schema: Schema, messageArgs: [string, string], category?: import("./Diagnostic").DiagnosticCategory): { readonly code: string; readonly messageText: string; readonly schema: Schema; readonly diagnosticType: DiagnosticType; ecDefinition: Schema; messageArgs?: [string, string] | undefined; category: import("./Diagnostic").DiagnosticCategory; }; code: string; diagnosticType: DiagnosticType; }; /** EC-002: Required message parameters: schema name, reference schema alias, first schema reference name, second schema reference name. */ SchemaRefAliasMustBeUnique: { new (schema: Schema, messageArgs: [string, string, string, string], category?: import("./Diagnostic").DiagnosticCategory): { readonly code: string; readonly messageText: string; readonly schema: Schema; readonly diagnosticType: DiagnosticType; ecDefinition: Schema; messageArgs?: [string, string, string, string] | undefined; category: import("./Diagnostic").DiagnosticCategory; }; code: string; diagnosticType: DiagnosticType; }; /** EC-003: Required message parameters: schema name, cycle text */ ReferenceCyclesNotAllowed: { new (schema: Schema, messageArgs: [string, string], category?: import("./Diagnostic").DiagnosticCategory): { readonly code: string; readonly messageText: string; readonly schema: Schema; readonly diagnosticType: DiagnosticType; ecDefinition: Schema; messageArgs?: [string, string] | undefined; category: import("./Diagnostic").DiagnosticCategory; }; code: string; diagnosticType: DiagnosticType; }; /** EC-100: Required message parameters: childClass.FullName, baseClass.FullName */ BaseClassIsSealed: { new (ecClass: AnyClass, messageArgs: [string, string], category?: import("./Diagnostic").DiagnosticCategory): { readonly code: string; readonly messageText: string; readonly schema: Schema; readonly diagnosticType: DiagnosticType; ecDefinition: AnyClass; messageArgs?: [string, string] | undefined; category: import("./Diagnostic").DiagnosticCategory; }; diagnosticType: DiagnosticType; }; /** EC-101: Required message parameters: childClass.FullName, baseClass.FullName, baseClass.schemaItemType */ BaseClassIsOfDifferentType: { new (ecClass: AnyClass, messageArgs: [string, string, string], category?: import("./Diagnostic").DiagnosticCategory): { readonly code: string; readonly messageText: string; readonly schema: Schema; readonly diagnosticType: DiagnosticType; ecDefinition: AnyClass; messageArgs?: [string, string, string] | undefined; category: import("./Diagnostic").DiagnosticCategory; }; diagnosticType: DiagnosticType; }; /** **DEPRECATED** EC-102: Required message parameters: childClass.FullName, baseClass.FullName */ AbstractClassWithNonAbstractBase: { new (ecClass: AnyClass, messageArgs: [string, string], category?: import("./Diagnostic").DiagnosticCategory): { readonly code: string; readonly messageText: string; readonly schema: Schema; readonly diagnosticType: DiagnosticType; ecDefinition: AnyClass; messageArgs?: [string, string] | undefined; category: import("./Diagnostic").DiagnosticCategory; }; diagnosticType: DiagnosticType; }; /** EC-500: Required message parameters: CustomAttribute container name and CustomAttributeClass name. */ CustomAttributeNotOfConcreteClass: { new (container: CustomAttributeContainerProps, messageArgs: [string, string], category?: import("./Diagnostic").DiagnosticCategory): { readonly code: string; readonly messageText: string; readonly schema: Schema; readonly diagnosticType: DiagnosticType; ecDefinition: CustomAttributeContainerProps; messageArgs?: [string, string] | undefined; category: import("./Diagnostic").DiagnosticCategory; }; }; /** EC-501: Required message parameters: CustomAttribute container name, CustomAttributeClass name, CustomAttributeClass Schema name. */ CustomAttributeSchemaMustBeReferenced: { new (container: CustomAttributeContainerProps, messageArgs: [string, string], category?: import("./Diagnostic").DiagnosticCategory): { readonly code: string; readonly messageText: string; readonly schema: Schema; readonly diagnosticType: DiagnosticType; ecDefinition: CustomAttributeContainerProps; messageArgs?: [string, string] | undefined; category: import("./Diagnostic").DiagnosticCategory; }; }; /** EC-502: Required message parameters: CustomAttribute container name and CustomAttributeClass name. */ CustomAttributeClassNotFound: { new (container: CustomAttributeContainerProps, messageArgs: [string, string], category?: import("./Diagnostic").DiagnosticCategory): { readonly code: string; readonly messageText: string; readonly schema: Schema; readonly diagnosticType: DiagnosticType; ecDefinition: CustomAttributeContainerProps; messageArgs?: [string, string] | undefined; category: import("./Diagnostic").DiagnosticCategory; }; }; /** EC-700: Required message parameters: Enumeration name */ EnumerationTypeUnsupported: { new (ecDefinition: import("@itwin/ecschema-metadata").SchemaItem, messageArgs: [string], category?: import("./Diagnostic").DiagnosticCategory): { readonly code: string; readonly messageText: string; readonly schema: Schema; readonly diagnosticType: DiagnosticType; ecDefinition: Enumeration; messageArgs?: [string] | undefined; category: import("./Diagnostic").DiagnosticCategory; }; diagnosticType: DiagnosticType; }; /** EC-1100: Required message parameters: mixin class fullName, class fullName, applies to constraint class fullName */ MixinAppliedToClassMustDeriveFromConstraint: { new (ecDefinition: import("@itwin/ecschema-metadata").SchemaItem, messageArgs: [string, string, string], category?: import("./Diagnostic").DiagnosticCategory): { readonly code: string; readonly messageText: string; readonly schema: Schema; readonly diagnosticType: DiagnosticType; ecDefinition: EntityClass; messageArgs?: [string, string, string] | undefined; category: import("./Diagnostic").DiagnosticCategory; }; diagnosticType: DiagnosticType; }; /** EC-1300: Required message parameters: childClass.FullName, property name, baseClass.FullName, base value type, child value type */ IncompatibleValueTypePropertyOverride: { new (property: AnyProperty, messageArgs?: [string, string, string, string, string] | undefined, category?: import("./Diagnostic").DiagnosticCategory): { readonly code: string; readonly messageText: string; readonly schema: Schema; readonly diagnosticType: DiagnosticType; ecDefinition: AnyProperty; messageArgs?: [string, string, string, string, string] | undefined; category: import("./Diagnostic").DiagnosticCategory; }; code: string; }; /** EC-1301: Required message parameters: childClass.FullName, property name, baseClass.FullName, base property type, child property type */ IncompatibleTypePropertyOverride: { new (property: AnyProperty, messageArgs?: [string, string, string, string, string] | undefined, category?: import("./Diagnostic").DiagnosticCategory): { readonly code: string; readonly messageText: string; readonly schema: Schema; readonly diagnosticType: DiagnosticType; ecDefinition: AnyProperty; messageArgs?: [string, string, string, string, string] | undefined; category: import("./Diagnostic").DiagnosticCategory; }; code: string; }; /** EC-1302: Required message parameters: childClass.Name, property name, baseClass.Name, baseClass Koq name, baseClass Koq persistence unit name, child class Koq persistence unit name, child class Koq name */ IncompatibleUnitPropertyOverride: { new (property: AnyProperty, messageArgs?: [string, string, string, string, string, string, string] | undefined, category?: import("./Diagnostic").DiagnosticCategory): { readonly code: string; readonly messageText: string; readonly schema: Schema; readonly diagnosticType: DiagnosticType; ecDefinition: AnyProperty; messageArgs?: [string, string, string, string, string, string, string] | undefined; category: import("./Diagnostic").DiagnosticCategory; }; code: string; }; /** EC-1303: Required message parameters: property.fullName, navigation relationship.fullName */ NavigationRelationshipMustBeRoot: { new (property: AnyProperty, messageArgs?: [string, string] | undefined, category?: import("./Diagnostic").DiagnosticCategory): { readonly code: string; readonly messageText: string; readonly schema: Schema; readonly diagnosticType: DiagnosticType; ecDefinition: AnyProperty; messageArgs?: [string, string] | undefined; category: import("./Diagnostic").DiagnosticCategory; }; code: string; }; /** EC-1304: Required message parameters: property.fullName, navigation relationship.fullName */ NavigationTargetMustHaveSingularMultiplicity: { new (property: AnyProperty, messageArgs?: [string, string, string] | undefined, category?: import("./Diagnostic").DiagnosticCategory): { readonly code: string; readonly messageText: string; readonly schema: Schema; readonly diagnosticType: DiagnosticType; ecDefinition: AnyProperty; messageArgs?: [string, string, string] | undefined; category: import("./Diagnostic").DiagnosticCategory; }; code: string; }; /** EC-1305: Required message parameters: property.fullName, navigation relationship.fullName */ NavigationRelationshipAbstractConstraintEntityOrMixin: { new (property: AnyProperty, messageArgs?: [string, string] | undefined, category?: import("./Diagnostic").DiagnosticCategory): { readonly code: string; readonly messageText: string; readonly schema: Schema; readonly diagnosticType: DiagnosticType; ecDefinition: AnyProperty; messageArgs?: [string, string] | undefined; category: import("./Diagnostic").DiagnosticCategory; }; code: string; }; /** EC-1306: Required message parameters: class name, property name, navigation relationship.fullName */ NavigationClassMustBeAConstraintClassOfRelationship: { new (property: AnyProperty, messageArgs?: [string, string, string, string] | undefined, category?: import("./Diagnostic").DiagnosticCategory): { readonly code: string; readonly messageText: string; readonly schema: Schema; readonly diagnosticType: DiagnosticType; ecDefinition: AnyProperty; messageArgs?: [string, string, string, string] | undefined; category: import("./Diagnostic").DiagnosticCategory; }; code: string; }; /** EC-1500: Required message parameters: abstract constraint class name, relationship end (source/target), relationship name, base relationship name */ AbstractConstraintMustNarrowBaseConstraints: { new (ecDefinition: import("@itwin/ecschema-metadata").SchemaItem, messageArgs: [string, string, string, string], category?: import("./Diagnostic").DiagnosticCategory): { readonly code: string; readonly messageText: string; readonly schema: Schema; readonly diagnosticType: DiagnosticType; ecDefinition: RelationshipClass; messageArgs?: [string, string, string, string] | undefined; category: import("./Diagnostic").DiagnosticCategory; }; diagnosticType: DiagnosticType; }; /** EC-1501: Required message parameters: constraint class name, relationship end (source/target), relationship name, base relationship name */ DerivedConstraintsMustNarrowBaseConstraints: { new (ecDefinition: import("@itwin/ecschema-metadata").SchemaItem, messageArgs: [string, string, string, string], category?: import("./Diagnostic").DiagnosticCategory): { readonly code: string; readonly messageText: string; readonly schema: Schema; readonly diagnosticType: DiagnosticType; ecDefinition: RelationshipClass; messageArgs?: [string, string, string, string] | undefined; category: import("./Diagnostic").DiagnosticCategory; }; diagnosticType: DiagnosticType; }; /** EC-1502: Required message parameters: constraint class name, relationship end (source/target), relationship name, abstract constraint class name */ ConstraintClassesDeriveFromAbstractConstraint: { new (ecDefinition: import("@itwin/ecschema-metadata").SchemaItem, messageArgs: [string, string, string, string], category?: import("./Diagnostic").DiagnosticCategory): { readonly code: string; readonly messageText: string; readonly schema: Schema; readonly diagnosticType: DiagnosticType; ecDefinition: RelationshipClass; messageArgs?: [string, string, string, string] | undefined; category: import("./Diagnostic").DiagnosticCategory; }; diagnosticType: DiagnosticType; }; /** EC-1600: Required message parameters: relationship end (source/target), relationship name */ AtLeastOneConstraintClassDefined: { new (constraint: RelationshipConstraint, messageArgs: [string, string], category?: import("./Diagnostic").DiagnosticCategory): { readonly code: string; readonly messageText: string; readonly schema: Schema; readonly diagnosticType: DiagnosticType; ecDefinition: RelationshipConstraint; messageArgs?: [string, string] | undefined; category: import("./Diagnostic").DiagnosticCategory; }; }; /** EC-1601: Required message parameters: relationship end (source/target), relationship name */ AbstractConstraintMustExistWithMultipleConstraints: { new (constraint: RelationshipConstraint, messageArgs: [string, string], category?: import("./Diagnostic").DiagnosticCategory): { readonly code: string; readonly messageText: string; readonly schema: Schema; readonly diagnosticType: DiagnosticType; ecDefinition: RelationshipConstraint; messageArgs?: [string, string] | undefined; category: import("./Diagnostic").DiagnosticCategory; }; }; /** EC-1602: Required message parameters: relationship end (source/target), relationship name, abstract constraint class name */ NonPolymorphicConstraintMustBeConcrete: { new (constraint: RelationshipConstraint, messageArgs: [string, string, string], category?: import("./Diagnostic").DiagnosticCategory): { readonly code: string; readonly messageText: string; readonly schema: Schema; readonly diagnosticType: DiagnosticType; ecDefinition: RelationshipConstraint; messageArgs?: [string, string, string] | undefined; category: import("./Diagnostic").DiagnosticCategory; }; }; }; /** * All schema validation rules that fall under the category of ECObjects. * @beta */ export declare const ECRuleSet: IRuleSet; /** * Validates schema references against multiple EC rules. * @param schema The schema to validate. * @internal */ export declare function validateSchemaReferences(schema: Schema): AsyncIterable>; /** * Validates schema references against multiple EC rules. * @param schema The schema to validate. * @internal */ export declare function validateSchemaReferencesSync(schema: Schema): Iterable>; /** * EC Rule: Sealed classes cannot be a base class. * @internal */ export declare function baseClassIsSealed(ecClass: AnyClass): AsyncIterable>; /** * EC Rule: Base and child class must be of the same type (i.e. Entity, Mixin, Relationship, etc.) * @internal */ export declare function baseClassIsOfDifferentType(ecClass: AnyClass): AsyncIterable>; /** * EC Rule: When overriding a class primitive property, the child and base property must be of the same type (string, number, etc...). * @internal */ export declare function incompatibleValueTypePropertyOverride(property: AnyProperty): AsyncIterable>; /** * EC Rule: When overriding a class property, the child and base property must be of the same property type (primitive, struct, enumeration, etc...). * @internal */ export declare function incompatibleTypePropertyOverride(property: AnyProperty): AsyncIterable>; /** * EC Rule: When overriding a kindOfQuantity property, the child and base property units must be the same. * @internal */ export declare function incompatibleUnitPropertyOverride(property: AnyProperty): AsyncIterable>; /** * Validates Navigation Properties. EC Rules: 1303, 1304 * @internal */ export declare function validateNavigationProperty(property: AnyProperty): AsyncIterable>; /** * Validates a Relationship class and yields EC-1500, EC-1501, and EC-1502 rule violations. * @internal */ export declare function validateRelationship(ecClass: RelationshipClass): AsyncIterable>; /** * EC Rule: When overriding a RelationshipClass, the derived abstract constraint must narrow the base constraint classes. * @internal */ export declare function abstractConstraintMustNarrowBaseConstraints(ecClass: RelationshipClass): AsyncIterable>; /** * EC Rule: When overriding a RelationshipClass, derived constraint classes must narrow base constraint classes. * @internal */ export declare function derivedConstraintsMustNarrowBaseConstraints(ecClass: RelationshipClass): AsyncIterable>; /** * EC Rule: All constraint classes must have a common base class specified in the abstract constraint. * @internal */ export declare function constraintClassesDeriveFromAbstractConstraint(ecClass: RelationshipClass): AsyncIterable>; /** * Validates a RelationshipConstraint and yields EC-1600, EC-1601, and EC-1602 rule violations. * @internal */ export declare function validateRelationshipConstraint(constraint: RelationshipConstraint): AsyncIterable>; /** * EC Rule: At least on concrete constraint class must be defined in the list of constraint classes. * @internal */ export declare function atLeastOneConstraintClassDefined(constraint: RelationshipConstraint): AsyncIterable>; /** * EC Rule: If multiple constraints exist, an abstract constraint must be defined. * @internal */ export declare function abstractConstraintMustExistWithMultipleConstraints(constraint: RelationshipConstraint): AsyncIterable>; /** * EC Rule: A relationship constraint that is not polymorphic must only reference concrete (non-abstract) classes * @internal */ export declare function nonPolymorphicConstraintMustBeConcrete(constraint: RelationshipConstraint): AsyncIterable>; /** * EC Rule: Enumeration type must be a string or integer * @internal */ export declare function enumerationTypeUnsupported(enumeration: Enumeration): AsyncIterable>; /** * EC Rule: Mixin applied to class must derived from the Mixin appliesTo constraint. * @internal */ export declare function mixinAppliedToClassMustDeriveFromConstraint(entityClass: EntityClass): AsyncIterable>; /** * Validates a custom attribute instance and yields EC-500, EC-501, and EC-502 rule violations. * @internal */ export declare function validateCustomAttributeInstance(container: CustomAttributeContainerProps, customAttribute: CustomAttribute): AsyncIterable>; //# sourceMappingURL=ECRules.d.ts.map