ValidationError.d.ts 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. export default ValidationError;
  2. export type JSONSchema6 = import("json-schema").JSONSchema6;
  3. export type JSONSchema7 = import("json-schema").JSONSchema7;
  4. export type Schema = import("./validate").Schema;
  5. export type ValidationErrorConfiguration =
  6. import("./validate").ValidationErrorConfiguration;
  7. export type PostFormatter = import("./validate").PostFormatter;
  8. export type SchemaUtilErrorObject = import("./validate").SchemaUtilErrorObject;
  9. declare class ValidationError extends Error {
  10. /**
  11. * @param {Array<SchemaUtilErrorObject>} errors
  12. * @param {Schema} schema
  13. * @param {ValidationErrorConfiguration} configuration
  14. */
  15. constructor(
  16. errors: Array<SchemaUtilErrorObject>,
  17. schema: Schema,
  18. configuration?: ValidationErrorConfiguration
  19. );
  20. /** @type {Array<SchemaUtilErrorObject>} */
  21. errors: Array<SchemaUtilErrorObject>;
  22. /** @type {Schema} */
  23. schema: Schema;
  24. /** @type {string} */
  25. headerName: string;
  26. /** @type {string} */
  27. baseDataPath: string;
  28. /** @type {PostFormatter | null} */
  29. postFormatter: PostFormatter | null;
  30. /**
  31. * @param {string} path
  32. * @returns {Schema}
  33. */
  34. getSchemaPart(path: string): Schema;
  35. /**
  36. * @param {Schema} schema
  37. * @param {boolean} logic
  38. * @param {Array<Object>} prevSchemas
  39. * @returns {string}
  40. */
  41. formatSchema(
  42. schema: Schema,
  43. logic?: boolean,
  44. prevSchemas?: Array<Object>
  45. ): string;
  46. /**
  47. * @param {Schema=} schemaPart
  48. * @param {(boolean | Array<string>)=} additionalPath
  49. * @param {boolean=} needDot
  50. * @param {boolean=} logic
  51. * @returns {string}
  52. */
  53. getSchemaPartText(
  54. schemaPart?: Schema | undefined,
  55. additionalPath?: (boolean | Array<string>) | undefined,
  56. needDot?: boolean | undefined,
  57. logic?: boolean | undefined
  58. ): string;
  59. /**
  60. * @param {Schema=} schemaPart
  61. * @returns {string}
  62. */
  63. getSchemaPartDescription(schemaPart?: Schema | undefined): string;
  64. /**
  65. * @param {SchemaUtilErrorObject} error
  66. * @returns {string}
  67. */
  68. formatValidationError(error: SchemaUtilErrorObject): string;
  69. /**
  70. * @param {Array<SchemaUtilErrorObject>} errors
  71. * @returns {string}
  72. */
  73. formatValidationErrors(errors: Array<SchemaUtilErrorObject>): string;
  74. }