z-schema-errors normalizes error messages from Z-Schema JSON Schema validation reports. It transforms nested property paths (e.g., '#/items/[0]' → 'items[0]'), extracts first array params, and allows custom message formatting using macros like {message}, {path}, {description}, and {params[i]}. Supports global context messages and custom extractors for each macro. Version 0.2.1 is the latest; no recent updates. As a thin wrapper around Z-Schema, it only works with that validator. No TypeScript types are provided, and it uses CommonJS.
npm install z-schema-errorsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage: validate JSON with Z-Schema, then use z-schema-errors to generate a human-readable error message.
Use reporter.extractMessage({ report: validator.lastReport }) instead of reporter.extractMessage(validator.lastReport.errors).Consider migrating to ajv-errors or manually formatting Z-Schema errors.
Stick to the documented macros: {message}, {path}, {description}, {params[i]}, {contextMessage}.If your schema errors have complex params, verify the output; consider custom extractors.
Use const ZSchemaErrors = require('z-schema-errors'); then ZSchemaErrors.init();Call reporter.extractMessage({ report: validator.lastReport })Run npm install z-schema