{"id":18609676,"url":"https://github.com/unlight/class-validator-flat-formatter","last_synced_at":"2025-04-10T22:31:41.879Z","repository":{"id":57199513,"uuid":"351441534","full_name":"unlight/class-validator-flat-formatter","owner":"unlight","description":"Convert array of ValidationError objects from class-validator to multiline string","archived":false,"fork":false,"pushed_at":"2024-10-26T19:14:25.000Z","size":330,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-26T21:26:33.636Z","etag":null,"topics":["class-validator","error-formatters","error-formatting","validation-error"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unlight.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-25T13:12:11.000Z","updated_at":"2024-10-26T19:14:29.000Z","dependencies_parsed_at":"2024-04-21T18:54:57.260Z","dependency_job_id":"9ad432e7-4848-4ddf-916d-4f77370f64ed","html_url":"https://github.com/unlight/class-validator-flat-formatter","commit_stats":{"total_commits":18,"total_committers":2,"mean_commits":9.0,"dds":0.2222222222222222,"last_synced_commit":"85a29c2bfaa44b551324bf4159dd3c2de8d6a0b1"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unlight%2Fclass-validator-flat-formatter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unlight%2Fclass-validator-flat-formatter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unlight%2Fclass-validator-flat-formatter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unlight%2Fclass-validator-flat-formatter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unlight","download_url":"https://codeload.github.com/unlight/class-validator-flat-formatter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223449848,"owners_count":17146984,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["class-validator","error-formatters","error-formatting","validation-error"],"created_at":"2024-11-07T03:06:56.318Z","updated_at":"2024-11-07T03:06:56.980Z","avatar_url":"https://github.com/unlight.png","language":"TypeScript","readme":"# class-validator-flat-formatter\n\nConvert array of ValidationError objects from class-validator to multiline string\n\n## Install\n\n```sh\nnpm install class-validator-flat-formatter\n```\n\n## Usage\n\n#### As string\n\n```ts\nimport { validationError } from 'class-validator-flat-formatter';\n\nconst errors = await validate(user);\n\nconst message = validationError(errors, options);\n// message =\u003e name: should not be empty (isNotEmpty), email: must be an email (isEmail)\n```\n\n##### Options\n\n```ts\nexport interface ValidationErrorOptions {\n  /**\n   * Custom template, tokens:\n   * {propertyPath} - Full dotted property path (e.g user.email)\n   * {property} - Last piece of {propertyPath} (e.g. email)\n   * {constraintRule} - Constraint rule id (e.g. isEmail)\n   * {constraintMessage} - Constraint message (e.g. must be an email)\n   */\n  template?: string;\n  /**\n   * Delimiter of joined several validation messages.\n   * Default: Comma and space (CS)\n   */\n  delimiter?: Delimiter | string;\n  /**\n   * Period at the end of string.\n   * Default: false\n   */\n  period?: boolean;\n}\n```\n\n#### As array\n\n```ts\nimport { validationErrorsAsArray } from 'class-validator-flat-formatter';\n\nconst errors = await validate(user);\nconst messages = validationErrorsAsArray(errors);\n/** \nmessages =\u003e Array\u003cstring\u003e {\n    'name: should not be empty (isNotEmpty)',\n    'email: must be an email (isEmail)'\n}\n*/\n```\n\n## License\n\n[MIT License](https://opensource.org/licenses/MIT) (c) 2024\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funlight%2Fclass-validator-flat-formatter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funlight%2Fclass-validator-flat-formatter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funlight%2Fclass-validator-flat-formatter/lists"}