{"id":22156316,"url":"https://github.com/xanke/egg-async-validator-stage","last_synced_at":"2025-03-24T14:33:14.335Z","repository":{"id":57156923,"uuid":"164550556","full_name":"xanke/egg-async-validator-stage","owner":"xanke","description":null,"archived":false,"fork":false,"pushed_at":"2020-09-15T00:31:20.000Z","size":4,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-21T15:12:54.100Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/xanke.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-08T03:24:37.000Z","updated_at":"2019-01-08T03:25:27.000Z","dependencies_parsed_at":"2022-09-03T18:51:02.795Z","dependency_job_id":null,"html_url":"https://github.com/xanke/egg-async-validator-stage","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xanke%2Fegg-async-validator-stage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xanke%2Fegg-async-validator-stage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xanke%2Fegg-async-validator-stage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xanke%2Fegg-async-validator-stage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xanke","download_url":"https://codeload.github.com/xanke/egg-async-validator-stage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245289815,"owners_count":20591138,"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-12-02T02:41:00.929Z","updated_at":"2025-03-24T14:33:14.294Z","avatar_url":"https://github.com/xanke.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# egg-async-validator-stage\n\nValidate plugin for egg, compatible [egg-validate](https://github.com/eggjs/egg-validate) method.\n\nsee [async-validate](https://github.com/yiminghe/async-validator) for more information such as custom rule.\n\n## Install\n\n```bash\n$ npm i egg-async-validator-stage --save\n```\n\n## Usage\n\n```js\n// {app_root}/config/plugin.js\nexports.validate = {\n  enable: true,\n  package: 'egg-async-validator-stage',\n};\n```\n\n## Configuration\n\n```js\n// {app_root}/config/config.default.js\nexports.validate = {\n  messages: {},\n};\n```\n\nsee [async-validator#messages](https://github.com/yiminghe/async-validator#messages) for more detail.\n\n## Example\n\n```js\n// {app_root}/app/controller/home.js\nexports.index = async ctx =\u003e {\n\n  // will throw if invalid.\n  await ctx.validate({\n    data: { type: 'object', required: true },\n  }, {\n    data: '1',\n  });\n\n  // if you want to get errors info,\n  // use try { ... } catch (err) { ... } to get\n  // example\n  try {\n    await ctx.validate({ data: { type: 'object', required: true } }); // validate target, default to `this.request.body`\n  } catch (err) {\n    const errors = err.errors;\n  }\n\n};\n```\nrules see [async-validator#rules](https://github.com/yiminghe/async-validator#rules) for more detail.\n\n\u003e !!important:  `method`,`date`,`hex` in `type` does not apply to server - side form validation\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxanke%2Fegg-async-validator-stage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxanke%2Fegg-async-validator-stage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxanke%2Fegg-async-validator-stage/lists"}