validate.d.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. export type JSONSchema4 = import("json-schema").JSONSchema4;
  2. export type JSONSchema6 = import("json-schema").JSONSchema6;
  3. export type JSONSchema7 = import("json-schema").JSONSchema7;
  4. export type ErrorObject = import("ajv").ErrorObject;
  5. export type Extend = {
  6. formatMinimum?: string | undefined;
  7. formatMaximum?: string | undefined;
  8. formatExclusiveMinimum?: string | undefined;
  9. formatExclusiveMaximum?: string | undefined;
  10. link?: string | undefined;
  11. };
  12. export type Schema = (JSONSchema4 | JSONSchema6 | JSONSchema7) & Extend;
  13. export type SchemaUtilErrorObject = ErrorObject & {
  14. children?: Array<ErrorObject>;
  15. };
  16. export type PostFormatter = (
  17. formattedError: string,
  18. error: SchemaUtilErrorObject
  19. ) => string;
  20. export type ValidationErrorConfiguration = {
  21. name?: string | undefined;
  22. baseDataPath?: string | undefined;
  23. postFormatter?: PostFormatter | undefined;
  24. };
  25. /**
  26. * @param {Schema} schema
  27. * @param {Array<object> | object} options
  28. * @param {ValidationErrorConfiguration=} configuration
  29. * @returns {void}
  30. */
  31. export function validate(
  32. schema: Schema,
  33. options: Array<object> | object,
  34. configuration?: ValidationErrorConfiguration | undefined
  35. ): void;
  36. import ValidationError from "./ValidationError";
  37. export { ValidationError };