/** @packageDocumentation * @module Diagnostic */ import { AnyClass, AnyECType, AnyProperty, CustomAttributeContainerProps, RelationshipConstraint, Schema, SchemaItem } from "@itwin/ecschema-metadata"; /** * Defines the possible diagnostic types. * @beta */ export declare enum DiagnosticType { None = 0, Schema = 1, SchemaItem = 2, Property = 3, CustomAttributeContainer = 4, RelationshipConstraint = 5 } /** * Defines the possible diagnostic categories. * @beta */ export declare enum DiagnosticCategory { Warning = 0, Error = 1, Suggestion = 2, Message = 3 } /** * The interface implemented by all diagnostics used during schema validation. * @beta */ export interface IDiagnostic { /** The diagnostic category (error, warning, etc...). Value is static across all instances. */ category: DiagnosticCategory; /** The unique string identifier of the diagnostic in the format ':. Value is static across all instances. */ code: string; /** The context type of diagnostic (schema, schema item, property, etc...). Value is static across all instances. */ diagnosticType: DiagnosticType; /** The unformatted message text associated with the diagnostic. Value is static across all instances. */ messageText: string; /** The arguments used when formatted the diagnostic instance's message. */ messageArgs?: ARGS; /** The EC object associated with the diagnostic instance. */ ecDefinition: TYPE; /** The schema where the diagnostic originated. */ schema: Schema; } /** * Type which encapsulates all possible diagnostics. * @beta */ export type AnyDiagnostic = IDiagnostic; /** * The abstract base class for all [[IDiagnostic]] implementations. * @beta */ export declare abstract class BaseDiagnostic implements IDiagnostic { /** * Initializes a new BaseDiagnostic. * @param ecDefinition The EC object to associate with the diagnostic. * @param messageArgs The arguments used when formatting the diagnostic message. * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default. */ constructor(ecDefinition: TYPE, messageArgs?: ARGS, category?: DiagnosticCategory); /** Gets the unique string identifier for the diagnostic in the format ':'. */ abstract get code(): string; /** Gets the context type of the diagnostic (schema, schema item, property, etc...) */ abstract get diagnosticType(): DiagnosticType; /** Gets the message associated with the diagnostic. */ abstract get messageText(): string; /** Gets the schema where the diagnostic originated. */ abstract get schema(): Schema; /** The EC object to associate with the diagnostic. */ ecDefinition: TYPE; /** The arguments used when formatting the diagnostic message. */ messageArgs?: ARGS; /** The diagnostic category is of the type DiagnosticCategory; which is defined as an enumeration above. */ category: DiagnosticCategory; } /** * An [[IDiagnostic]] implementation used for [[Schema]] diagnostics. * @beta */ export declare abstract class SchemaDiagnostic extends BaseDiagnostic { static diagnosticType: DiagnosticType; /** * Initializes a new SchemaDiagnostic. * @param ecDefinition The EC object to associate with the diagnostic. * @param messageArgs The arguments used when formatting the diagnostic message. * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default. */ constructor(schema: Schema, messageArgs: ARGS, category?: DiagnosticCategory); /** Gets the schema where the diagnostic originated. */ get schema(): Schema; /** Gets the DiagnosticType. */ get diagnosticType(): DiagnosticType; } /** * An [[IDiagnostic]] implementation used for [[SchemaItem]] diagnostics. * @beta */ export declare abstract class SchemaItemDiagnostic extends BaseDiagnostic { static diagnosticType: DiagnosticType; /** * Initializes a new SchemaItemDiagnostic. * @param ecDefinition The EC object to associate with the diagnostic. * @param messageArgs The arguments used when formatting the diagnostic message. * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default. */ constructor(ecDefinition: SchemaItem, messageArgs: ARGS, category?: DiagnosticCategory); /** Gets the schema where the diagnostic originated. */ get schema(): Schema; /** Gets the DiagnosticType. */ get diagnosticType(): DiagnosticType; } /** * An [[IDiagnostic]] implementation used for [[ECClass]] diagnostics. * @beta */ export declare abstract class ClassDiagnostic extends SchemaItemDiagnostic { /** * Initializes a new ClassDiagnostic. * @param ecClass The class to associate with the diagnostic. * @param messageArgs The arguments used when formatting the diagnostic message. * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default. */ constructor(ecClass: AnyClass, messageArgs: ARGS, category?: DiagnosticCategory); /** Gets the schema where the diagnostic originated. */ get schema(): Schema; } /** * An [[IDiagnostic]] implementation used for [[Property]] diagnostics. * @beta */ export declare abstract class PropertyDiagnostic extends BaseDiagnostic { /** * Initializes a new PropertyDiagnostic. * @param property The property to associate with the diagnostic. * @param messageArgs The arguments used when formatting the diagnostic message. * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default. */ constructor(property: AnyProperty, messageArgs?: ARGS, category?: DiagnosticCategory); /** Gets the schema where the diagnostic originated. */ get schema(): Schema; /** Gets the DiagnosticType. */ get diagnosticType(): DiagnosticType; } /** * An [[IDiagnostic]] implementation used for [[RelationshipConstraint]] diagnostics. * @beta */ export declare abstract class RelationshipConstraintDiagnostic extends BaseDiagnostic { /** * Initializes a new RelationshipConstraintDiagnostic. * @param constraint The Relationship Constraint to associate with the diagnostic. * @param messageArgs The arguments used when formatting the diagnostic message. * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default. */ constructor(constraint: RelationshipConstraint, messageArgs: ARGS, category?: DiagnosticCategory); /** Gets the schema where the diagnostic originated. */ get schema(): Schema; /** Gets the DiagnosticType. */ get diagnosticType(): DiagnosticType; } /** * An [[IDiagnostic]] implementation used for [[CustomAttributeContainerProps]] diagnostics. * @beta */ export declare abstract class CustomAttributeContainerDiagnostic extends BaseDiagnostic { /** * Initializes a new CustomAttributeContainerDiagnostic. * @param constraint The Custom Attribute Container to associate with the diagnostic. * @param messageArgs The arguments used when formatting the diagnostic message. * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default. */ constructor(container: CustomAttributeContainerProps, messageArgs: ARGS, category?: DiagnosticCategory); /** Gets the schema where the diagnostic originated. */ get schema(): Schema; /** Gets the DiagnosticType. */ get diagnosticType(): DiagnosticType; } /** * Helper method for creating [[SchemaDiagnostic]] child classes. * @param code The string that uniquely identifies the diagnostic in the format ':'. * @param messageText The message to associate with the diagnostic class. * @beta */ export declare function createSchemaDiagnosticClass(code: string, messageText: string): { new (schema: Schema, messageArgs: ARGS, category?: DiagnosticCategory): { readonly code: string; readonly messageText: string; /** Gets the schema where the diagnostic originated. */ readonly schema: Schema; /** Gets the DiagnosticType. */ readonly diagnosticType: DiagnosticType; /** The EC object to associate with the diagnostic. */ ecDefinition: Schema; /** The arguments used when formatting the diagnostic message. */ messageArgs?: ARGS | undefined; /** The diagnostic category is of the type DiagnosticCategory; which is defined as an enumeration above. */ category: DiagnosticCategory; }; code: string; diagnosticType: DiagnosticType; }; /** * Helper method for creating [[SchemaItemDiagnostic]] child classes. * @param code The string that uniquely identifies the diagnostic in the format ':'. * @param messageText The message to associate with the diagnostic class. * @beta */ export declare function createSchemaItemDiagnosticClass(code: string, messageText: string): { new (ecDefinition: SchemaItem, messageArgs: ARGS, category?: DiagnosticCategory): { readonly code: string; readonly messageText: string; /** Gets the schema where the diagnostic originated. */ readonly schema: Schema; /** Gets the DiagnosticType. */ readonly diagnosticType: DiagnosticType; /** The EC object to associate with the diagnostic. */ ecDefinition: ITEM; /** The arguments used when formatting the diagnostic message. */ messageArgs?: ARGS | undefined; /** The diagnostic category is of the type DiagnosticCategory; which is defined as an enumeration above. */ category: DiagnosticCategory; }; diagnosticType: DiagnosticType; }; /** * Helper method for creating [[ClassDiagnostic]] child classes. * @param code The string that uniquely identifies the diagnostic in the format ':'. * @param messageText The message to associate with the diagnostic class. * @beta */ export declare function createClassDiagnosticClass(code: string, messageText: string): { new (ecClass: AnyClass, messageArgs: ARGS, category?: DiagnosticCategory): { readonly code: string; readonly messageText: string; /** Gets the schema where the diagnostic originated. */ readonly schema: Schema; /** Gets the DiagnosticType. */ readonly diagnosticType: DiagnosticType; /** The EC object to associate with the diagnostic. */ ecDefinition: AnyClass; /** The arguments used when formatting the diagnostic message. */ messageArgs?: ARGS | undefined; /** The diagnostic category is of the type DiagnosticCategory; which is defined as an enumeration above. */ category: DiagnosticCategory; }; diagnosticType: DiagnosticType; }; /** * Helper method for creating [[PropertyDiagnostic]] child classes. * @param code The string that uniquely identifies the diagnostic in the format ':'. * @param messageText The message to associate with the diagnostic class. * @beta */ export declare function createPropertyDiagnosticClass(code: string, messageText: string): { new (property: AnyProperty, messageArgs?: ARGS | undefined, category?: DiagnosticCategory): { readonly code: string; readonly messageText: string; /** Gets the schema where the diagnostic originated. */ readonly schema: Schema; /** Gets the DiagnosticType. */ readonly diagnosticType: DiagnosticType; /** The EC object to associate with the diagnostic. */ ecDefinition: AnyProperty; /** The arguments used when formatting the diagnostic message. */ messageArgs?: ARGS | undefined; /** The diagnostic category is of the type DiagnosticCategory; which is defined as an enumeration above. */ category: DiagnosticCategory; }; code: string; }; /** * Helper method for creating [[RelationshipConstraintDiagnostic]] child classes. * @param code The string that uniquely identifies the type of diagnostic in the format ':'. * @param messageText The message to associate with the diagnostic class. * @beta */ export declare function createRelationshipConstraintDiagnosticClass(code: string, messageText: string): { new (constraint: RelationshipConstraint, messageArgs: ARGS, category?: DiagnosticCategory): { readonly code: string; readonly messageText: string; /** Gets the schema where the diagnostic originated. */ readonly schema: Schema; /** Gets the DiagnosticType. */ readonly diagnosticType: DiagnosticType; /** The EC object to associate with the diagnostic. */ ecDefinition: RelationshipConstraint; /** The arguments used when formatting the diagnostic message. */ messageArgs?: ARGS | undefined; /** The diagnostic category is of the type DiagnosticCategory; which is defined as an enumeration above. */ category: DiagnosticCategory; }; }; /** * Helper method for creating [[CustomAttributeContainerDiagnostic]] child classes. * @param code The that uniquely identifies the type of diagnostic in the format ':'. * @param messageText The message to associate with the diagnostic class. * @beta */ export declare function createCustomAttributeContainerDiagnosticClass(code: string, messageText: string): { new (container: CustomAttributeContainerProps, messageArgs: ARGS, category?: DiagnosticCategory): { readonly code: string; readonly messageText: string; /** Gets the schema where the diagnostic originated. */ readonly schema: Schema; /** Gets the DiagnosticType. */ readonly diagnosticType: DiagnosticType; /** The EC object to associate with the diagnostic. */ ecDefinition: CustomAttributeContainerProps; /** The arguments used when formatting the diagnostic message. */ messageArgs?: ARGS | undefined; /** The diagnostic category is of the type DiagnosticCategory; which is defined as an enumeration above. */ category: DiagnosticCategory; }; }; /** @beta */ export declare function diagnosticCategoryToString(category: DiagnosticCategory): "Error" | "Warning" | "Message" | "Suggestion"; /** @beta */ export declare function diagnosticTypeToString(type: DiagnosticType): "CustomAttributeContainer" | "None" | "Property" | "RelationshipConstraint" | "Schema" | "SchemaItem"; //# sourceMappingURL=Diagnostic.d.ts.map