{"id":40722,"library":"class-validator-message-formatter","title":"class-validator-message-formatter","description":"A lightweight utility for formatting class-validator validation errors into a cleaner, more readable structure. Version 0.0.3, no active release cadence. Key differentiator: transforms the complex ValidationError array from class-validator into a simple array of {field, message} objects, making it easier to display or process validation errors in applications.","status":"active","version":"0.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/loveloper44/class-validator-message-formatter","tags":["javascript","class-validator","message","typescript"],"install":[{"cmd":"npm install class-validator-message-formatter","lang":"bash","label":"npm"},{"cmd":"yarn add class-validator-message-formatter","lang":"bash","label":"yarn"},{"cmd":"pnpm add class-validator-message-formatter","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM only; no CommonJS export.","symbol":"MessageFormatter","correct":"import { MessageFormatter } from 'class-validator-message-formatter'"},{"note":"ValidationError is from class-validator, not this package.","wrong":"import { ValidationError } from 'class-validator-message-formatter'","symbol":"ValidationError","correct":"import { ValidationError } from 'class-validator'"},{"note":"Only named export exists.","wrong":"import MessageFormatter from 'class-validator-message-formatter'","symbol":"default import","correct":"import { MessageFormatter } from 'class-validator-message-formatter'"}],"quickstart":{"code":"import { validateSync } from 'class-validator';\nimport { IsString } from 'class-validator';\nimport { MessageFormatter } from 'class-validator-message-formatter';\n\nclass User {\n    @IsString()\n    name: string;\n\n    @IsString()\n    address: string;\n\n    constructor(name: string, address: string) {\n        this.name = name;\n        this.address = address;\n    }\n}\n\nconst user = new User();\nconst errors = validateSync(user);\nconst formatted = MessageFormatter.format(errors);\nconsole.log(formatted);\n// Output:\n// [ { field: 'name', message: 'name must be a string' },\n//   { field: 'address', message: 'address must be a string' } ]","lang":"typescript","description":"Demonstrates formatting class-validator validation errors into simplified {field, message} array."},"warnings":[{"fix":"Ensure input is the array returned by validate or validateSync.","message":"MessageFormatter.format expects argument of type ValidationError[]; passing wrong type will cause runtime error.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"This package is a helper for class-validator and does not replace it.","message":"Package only works with class-validator, not standalone validation.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"search_vec":"'0.0.3':23 'activ':25 'applic':57 'array':34,42 'cadenc':27 'class':2,12,37,60 'class-valid':11,36,59 'class-validator-message-formatt':1 'cleaner':18 'complex':32 'differenti':29 'display':51 'easier':49 'error':15,55 'field':44 'format':10 'formatt':5 'javascript':58 'key':28 'lightweight':7 'make':47 'messag':4,45,62 'object':46 'process':53 'readabl':20 'releas':26 'simpl':41 'structur':21 'transform':30 'typescript':63 'util':8 'valid':3,13,14,38,54,61 'validationerror':33 'version':22","created_at":"2026-06-04T18:48:56.151409+00:00","updated_at":"2026-06-04T18:48:56.151409+00:00","problems":[{"fix":"Use import { MessageFormatter } from 'class-validator-message-formatter' instead of import MessageFormatter from ...","cause":"Incorrect import: default import instead of named import.","error":"TypeError: MessageFormatter.format is not a function"},{"fix":"Run npm install class-validator-message-formatter and ensure no typo.","cause":"Package not installed or typo in package name.","error":"Cannot find module 'class-validator-message-formatter'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/loveloper44/class-validator-message-formatter#readme","github":"https://github.com/loveloper44/class-validator-message-formatter","docs":null,"changelog":null,"pypi":null,"npm":"class-validator-message-formatter","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}