/** @packageDocumentation * @module Diagnostic */ import { Localization } from "@itwin/core-common"; import { AnyDiagnostic } from "./Diagnostic"; /** * Interface used to report [[IDiagnostic]] objects created during schema validation. * @beta */ export interface IDiagnosticReporter { /** * A map where the key is a schema full name and the value is a collection * of diagnostics codes identifying which rules violations to ignore during validation. */ suppressions?: Map; /** The localization object to use for message translation. */ localization?: Localization; /** * Handles the given [[IDiagnostic]] based on the implementation requirements for a * given reporter. * @param diagnostic The diagnostic to report. */ report(diagnostic: AnyDiagnostic): void; } /** * An abstract base class for [[IDiagnosticReporter]] implementation that used the * provided Map to suppress certain rule violations from being reported. The Map's key * a schema full name, and the Map's value is a collection of rule codes to suppress. * @beta */ export declare abstract class SuppressionDiagnosticReporter implements IDiagnosticReporter { private _suppressions?; /** * Initializes a new SuppressionDiagnosticReporter * @param suppressions A Map where the key is a schema full name and the value is collection of diagnostic codes to suppress. */ constructor(suppressions?: Map); /** * Gets the collection of ISchemaDiagnosticSuppression objects that identify * rules violations to ignore during validation. */ get suppressions(): Map | undefined; /** * Prior to reporting the [[IDiagnostic]], the diagnostic message is formatted (with translations) * base on arguments contained in the diagnostic. Calls reportDiagnostic after the message is formatted. * @param diagnostic The diagnostic to report. */ report(diagnostic: AnyDiagnostic): void; /** * Handles the given [[IDiagnostic]] based on the implementation requirements for a * given reporter. * @param diagnostic The diagnostic to report. */ protected abstract reportInternal(diagnostic: AnyDiagnostic): void; } /** * An abstract [[SuppressionDiagnosticReporter]] implementation that formats the * diagnostic message with the message args. If a Localization implementation is specified, * the message will also be translated. * @beta */ export declare abstract class FormatDiagnosticReporter extends SuppressionDiagnosticReporter { /** * Initializes a new FormatDiagnosticReporter * @param suppressions A Map where the key is a schema full name and the value is collection of diagnostic codes to suppress. * @param localization The Localization instance to use to translate validation messages. */ constructor(suppressions?: Map, localization?: Localization); /** The Localization object to use for message translation. If undefined, no translation will occur. */ localization?: Localization; /** * Prior to reporting the [[IDiagnostic]], the diagnostic message is formatted (with translations) * base on arguments contained in the diagnostic. Calls reportDiagnostic after the message is formatted. * @param diagnostic The diagnostic to report. */ reportInternal(diagnostic: AnyDiagnostic): void; /** * Handles the given [[IDiagnostic]] based on the implementation requirements for a * given reporter. * @param diagnostic The diagnostic to report. * @param messageText The formatted message. */ protected abstract reportDiagnostic(diagnostic: AnyDiagnostic, messageText: string): void; /** * Helper method that formats string with provided arguments where the place holders * are in the the format '{0}', '{1}', etc. * @param text The text to format. * @param args The arguments to place in the text. * @param baseIndex The base index for the args, used for validation (typically 0, which is the default). */ protected formatStringFromArgs(text: string, args: ArrayLike, baseIndex?: number): string; private formatMessage; private translateMessage; private getTranslationKey; private assertDefined; } //# sourceMappingURL=DiagnosticReporter.d.ts.map