{"id":15354686,"url":"https://github.com/kulakowka/feathers-validate-hook","last_synced_at":"2025-04-15T06:16:25.902Z","repository":{"id":57234128,"uuid":"52166393","full_name":"kulakowka/feathers-validate-hook","owner":"kulakowka","description":"Feathers hook for validate json-schema with is-my-json-valid","archived":false,"fork":false,"pushed_at":"2019-07-20T03:41:42.000Z","size":47,"stargazers_count":12,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T06:16:19.308Z","etag":null,"topics":["feathers-hook","feathersjs","json"],"latest_commit_sha":null,"homepage":"https://code-typing-tutor.com","language":"HTML","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/kulakowka.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2016-02-20T17:41:58.000Z","updated_at":"2023-05-04T11:45:34.000Z","dependencies_parsed_at":"2022-09-05T19:01:09.548Z","dependency_job_id":null,"html_url":"https://github.com/kulakowka/feathers-validate-hook","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/kulakowka%2Ffeathers-validate-hook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kulakowka%2Ffeathers-validate-hook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kulakowka%2Ffeathers-validate-hook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kulakowka%2Ffeathers-validate-hook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kulakowka","download_url":"https://codeload.github.com/kulakowka/feathers-validate-hook/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249016644,"owners_count":21198833,"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":["feathers-hook","feathersjs","json"],"created_at":"2024-10-01T12:20:33.019Z","updated_at":"2025-04-15T06:16:25.882Z","avatar_url":"https://github.com/kulakowka.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"## feathers-validate-hook\n\n[![npm package](https://nodei.co/npm/feathers-validate-hook.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://nodei.co/npm/feathers-validate-hook/)\n\n[![NPM version](http://img.shields.io/npm/v/feathers-validate-hook.svg)](https://www.npmjs.org/package/feathers-validate-hook)\n[![Dependency Status](https://david-dm.org/kulakowka/feathers-validate-hook.svg)](https://david-dm.org/kulakowka/feathers-validate-hook)\n\n\nThis is experiment. **Work in progress!**\n\nFeathers hook for validate json-schema with [is-my-json-valid](https://www.npmjs.com/package/is-my-json-valid)\n\n```javascript\nconst validateHook = require('feathers-validate-hook')\n\n// Define schema \nconst schema = {\n  required: true,\n  type: 'object',\n  properties: {\n    // Required attribute 'text' with type 'string'\n    text: {\n      required: true,\n      type: 'string'\n    }\n  }\n}\n\napp.service('/messages').before({\n  create: [ \n    validateHook(schema)\n  ]\n})\n```\n\n## Example\n\nLook [example folder](https://github.com/kulakowka/feathers-validate-hook/tree/master/example) for more information.\n\nTest request:\n```\ncurl -H \"Accept: application/json\" -X POST http://localhost:3030/messages\n```\n\nServer response example:\n```\n{\n  \"name\": \"BadRequest\",\n  \"message\": \"Validation failed\",\n  \"code\": 400,\n  \"className\": \"bad-request\",\n  \"data\": {},\n  \"errors\": [\n    {\n      \"field\": \"data.text\",\n      \"message\": \"is required\",\n      \"type\": \"string\"\n    }\n  ]\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkulakowka%2Ffeathers-validate-hook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkulakowka%2Ffeathers-validate-hook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkulakowka%2Ffeathers-validate-hook/lists"}