{"id":18351855,"url":"https://github.com/codibly/api-validation","last_synced_at":"2025-04-10T00:37:23.078Z","repository":{"id":35162738,"uuid":"215299002","full_name":"codibly/api-validation","owner":"codibly","description":null,"archived":false,"fork":false,"pushed_at":"2023-01-04T22:45:25.000Z","size":623,"stargazers_count":1,"open_issues_count":24,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T07:05:39.759Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codibly.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.config.js","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-15T12:56:05.000Z","updated_at":"2019-11-22T12:33:28.000Z","dependencies_parsed_at":"2023-01-15T15:15:16.000Z","dependency_job_id":null,"html_url":"https://github.com/codibly/api-validation","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codibly%2Fapi-validation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codibly%2Fapi-validation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codibly%2Fapi-validation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codibly%2Fapi-validation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codibly","download_url":"https://codeload.github.com/codibly/api-validation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247953032,"owners_count":21023947,"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":[],"created_at":"2024-11-05T21:33:12.288Z","updated_at":"2025-04-10T00:37:23.055Z","avatar_url":"https://github.com/codibly.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @codibly/api-validation\n\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n[![commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n[![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://github.com/facebook/jest)\n\n[![npm version](https://img.shields.io/npm/v/@codibly/api-validation.svg)](https://www.npmjs.com/package/@codibly/api-validation)\n[![npm license](https://img.shields.io/npm/l/@codibly/api-validation.svg)](https://www.npmjs.com/package/@codibly/api-validation)\n[![npm downloads](https://img.shields.io/npm/dt/@codibly/api-validation.svg)](https://www.npmjs.com/package/@codibly/api-validation)\n[![npm types](https://img.shields.io/npm/types/@codibly/api-validation.svg)](https://www.npmjs.com/package/@codibly/api-validation)\n\n## Installation\n\nThis package is available as an [npm package](https://www.npmjs.com/package/@codibly/api-validation).\n\n```\nnpm install --save @codibly/api-validation\n```\n\nor\n\n```\nyarn add @codibly/api-validation\n```\n\n## Usage\n\nThe main gola of this library is to help is easy way handle api validation.\n####Error Code\n\n- VALIDATION_ERROR - validation form error code\n  ####Check error code\n  To check if error has valid error code we use function `isError`\n\n```\nfunction isError(ErrorCode, Response | undefined): error is Error {}\n```\n\n####Get form errors\nTo get validation form errors we have to functions which reducer array of errors to simple object where key is a filed name and value is a string or object.\n\n```\n- ValidationErrorMapper.toFormError(error: Error): FormError\n- ValidationErrorMapper.toFormErrorsWithSheetCells(error: Error, sheetField: string[]): FormError\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodibly%2Fapi-validation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodibly%2Fapi-validation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodibly%2Fapi-validation/lists"}