summarize

Summarize the error messages of issues in a pretty-printable multi-line string.

const errors = v.summarize(issues);

Parameters

Explanation

If an issue in issues contains a path that can be converted to a dot path, the dot path will be displayed in the errors output just below the issue's error message.

Returns

  • errors string

Examples

The following example show how summarize can be used.

const Schema = v.object({
  nested: v.object({
    foo: v.string('Value of "nested.foo" is invalid.'),
  }),
});

const result = v.safeParse(Schema, { nested: { foo: null } });

if (result.issues) {
  console.log(v.summarize(result.issues));
}

The following APIs can be combined with summarize.

Methods

Contributors

Thanks to all the contributors who helped make this page better!

  • GitHub profile picture of @fabian-hiller

Partners

Thanks to our partners who support the project ideally and financially.

Sponsors

Thanks to our GitHub sponsors who support the project financially.

  • GitHub profile picture of @antfu
  • GitHub profile picture of @Thanaen
  • GitHub profile picture of @osdiab
  • GitHub profile picture of @ruiaraujo012
  • GitHub profile picture of @hyunbinseo
  • GitHub profile picture of @F0rce
  • GitHub profile picture of @UniquePixels
  • GitHub profile picture of @jdgamble555
  • GitHub profile picture of @nickytonline
  • GitHub profile picture of @KubaJastrz
  • GitHub profile picture of @andrewmd5
  • GitHub profile picture of @caegdeveloper
  • GitHub profile picture of @dslatkin
  • GitHub profile picture of @BrianCurliss