{"id":20170204,"url":"https://github.com/fabrix-app/spool-joi","last_synced_at":"2025-07-13T17:09:05.676Z","repository":{"id":44974967,"uuid":"212384738","full_name":"fabrix-app/spool-joi","owner":"fabrix-app","description":"Spool: Joi validation extension for Fabrix","archived":false,"fork":false,"pushed_at":"2023-01-24T00:41:13.000Z","size":198,"stargazers_count":1,"open_issues_count":14,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-27T10:46:14.325Z","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/fabrix-app.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","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-02T16:07:54.000Z","updated_at":"2020-07-01T15:35:25.000Z","dependencies_parsed_at":"2023-01-31T13:30:58.492Z","dependency_job_id":null,"html_url":"https://github.com/fabrix-app/spool-joi","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/fabrix-app/spool-joi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabrix-app%2Fspool-joi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabrix-app%2Fspool-joi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabrix-app%2Fspool-joi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabrix-app%2Fspool-joi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fabrix-app","download_url":"https://codeload.github.com/fabrix-app/spool-joi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabrix-app%2Fspool-joi/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265175567,"owners_count":23722661,"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-14T01:17:40.409Z","updated_at":"2025-07-13T17:09:05.420Z","avatar_url":"https://github.com/fabrix-app.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# spool-joi\n\n[![Gitter][gitter-image]][gitter-url]\n[![NPM version][npm-image]][npm-url]\n[![Build Status][ci-image]][ci-url]\n[![Test Coverage][coverage-image]][coverage-url]\n[![Dependency Status][daviddm-image]][daviddm-url]\n[![Follow @FabrixApp on Twitter][twitter-image]][twitter-url]\n\n:package: Joi Spool\n\nA Spool to extend Fabrix with a unified validator for use in other spools and applications.\n\n[Joi](https://hapi.dev/family/joi/) is the most powerful validator for javascript, and making it a spool make it easy to use the same joi validator module in all of your other spools and applications.\n\n## Install\n```sh\n$ npm install --save @fabrix/spool-joi\n```\n\n## Configure\n\n```js\n// config/main.ts\nimport { joiSpool } from '@fabrix/spool-joi'\nexport const main = {\n  spools: [\n    // ... other spools\n    joiSpool\n  ]\n}\n```\n\n## Configuration\n\n```\n// config/joi.ts\nexport const joi = {\n}\n```\n\nFor more information about store (type and configuration) please see the joi documentation.\n\n## Usage\n\n```\n// Create some data to validate\nconst data = 'key'\n\n// Make a conveince const \nconst joi = this.app.validator\n\n// Create a Schema just like you would with joi\nconst schema = joi.alternatives().try(\n  joi.string().valid('key'),\n  joi.number().valid(5),\n  joi.object({\n    a: joi.boolean().valid(true)\n  })\n)\n\n// Validate the data against the schema\nthis.app.validate(data, schema)\n  .then(res =\u003e {\n    // Do something with the valid object\n  })\n  .catch(err =\u003e {\n    // Do something with the error\n  })\n\n\n// Optionally, you can pass a callback as well  \nthis.app.validate(data, schema, (error, value) =\u003e {\n  if (error) {\n    // Do somethign with the error\n  }\n  // Do something with the valid value\n})\n```\n\n\n[npm-image]: https://img.shields.io/npm/v/@fabrix/spool-joi.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/@fabrix/spool-joi\n[ci-image]: https://img.shields.io/circleci/project/github/fabrix-app/spool-joi/master.svg\n[ci-url]: https://circleci.com/gh/fabrix-app/spool-joi/tree/master\n[daviddm-image]: http://img.shields.io/david/fabrix-app/spool-joi.svg?style=flat-square\n[daviddm-url]: https://david-dm.org/fabrix-app/spool-joi\n[gitter-image]: http://img.shields.io/badge/+%20GITTER-JOIN%20CHAT%20%E2%86%92-1DCE73.svg?style=flat-square\n[gitter-url]: https://gitter.im/fabrix-app/fabrix\n[twitter-image]: https://img.shields.io/twitter/follow/FabrixApp.svg?style=social\n[twitter-url]: https://twitter.com/FabrixApp\n[coverage-image]: https://img.shields.io/codeclimate/coverage/github/fabrix-app/spool-joi.svg?style=flat-square\n[coverage-url]: https://codeclimate.com/github/fabrix-app/spool-joi/coverage\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabrix-app%2Fspool-joi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabrix-app%2Fspool-joi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabrix-app%2Fspool-joi/lists"}