{"id":19858098,"url":"https://github.com/tzsk/vuex-store-validator","last_synced_at":"2026-03-01T00:32:21.212Z","repository":{"id":47940267,"uuid":"287051063","full_name":"tzsk/vuex-store-validator","owner":"tzsk","description":"Validate Vuex Commits with Joi, Superstruct \u0026 Yup Schema.","archived":false,"fork":false,"pushed_at":"2021-08-11T16:48:17.000Z","size":7244,"stargazers_count":4,"open_issues_count":0,"forks_count":4,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-24T10:19:24.895Z","etag":null,"topics":["ajv-validation","joi-validation","store-plugin","superstruct-validation","type-checking","validator","vue","vuex","vuex-plugin","yup-validation"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/tzsk.png","metadata":{"files":{"readme":"readme.md","changelog":"CHANGELOG.md","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":"2020-08-12T15:33:52.000Z","updated_at":"2021-08-11T16:48:19.000Z","dependencies_parsed_at":"2022-08-12T14:41:16.260Z","dependency_job_id":null,"html_url":"https://github.com/tzsk/vuex-store-validator","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/tzsk/vuex-store-validator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tzsk%2Fvuex-store-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tzsk%2Fvuex-store-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tzsk%2Fvuex-store-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tzsk%2Fvuex-store-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tzsk","download_url":"https://codeload.github.com/tzsk/vuex-store-validator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tzsk%2Fvuex-store-validator/sbom","scorecard":{"id":905837,"data":{"date":"2025-08-11","repo":{"name":"github.com/tzsk/vuex-store-validator","commit":"fdf85c49e2581312cf1609fd00dd606704922d0d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/21 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/publish.yml:1","Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/tzsk/vuex-store-validator/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/tzsk/vuex-store-validator/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/tzsk/vuex-store-validator/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/tzsk/vuex-store-validator/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/tzsk/vuex-store-validator/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/tzsk/vuex-store-validator/test.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/tzsk/vuex-store-validator/test.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/tzsk/vuex-store-validator/test.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/publish.yml:45","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned","Info:   2 out of   3 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"73 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-c2jc-4fpr-4vhg","Warn: Project is vulnerable to: GHSA-whgm-jr23-g3j9","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-434g-2637-qmqr","Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m","Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw","Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p","Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc","Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx","Warn: Project is vulnerable to: GHSA-74fj-2j2h-c42q","Warn: Project is vulnerable to: GHSA-pw2r-vq6v-hr8c","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27","Warn: Project is vulnerable to: GHSA-4www-5p9h-95mh","Warn: Project is vulnerable to: GHSA-9gqv-wp59-fq42","Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22","Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq","Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488","Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-qrpm-p2h7-hrv2","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-5rrq-pxf6-6jx5","Warn: Project is vulnerable to: GHSA-8fr3-hfg3-gpgp","Warn: Project is vulnerable to: GHSA-gf8q-jrpm-jvxq","Warn: Project is vulnerable to: GHSA-2r2c-g63r-vccr","Warn: Project is vulnerable to: GHSA-cfm4-qjh2-4765","Warn: Project is vulnerable to: GHSA-x4jg-mjrx-434g","Warn: Project is vulnerable to: GHSA-rp65-9cf3-cjxr","Warn: Project is vulnerable to: GHSA-76c9-3jph-rj3q","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5","Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p","Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-5j4c-8p2g-v4jx","Warn: Project is vulnerable to: GHSA-g3ch-rx76-35fx","Warn: Project is vulnerable to: GHSA-hc6q-2mpp-qw7j","Warn: Project is vulnerable to: GHSA-4vvj-4cpr-p986","Warn: Project is vulnerable to: GHSA-wr3j-pwj9-hqq6","Warn: Project is vulnerable to: GHSA-4v9v-hfq4-rm2v","Warn: Project is vulnerable to: GHSA-9jgg-88mc-972h","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-24T17:19:16.523Z","repository_id":47940267,"created_at":"2025-08-24T17:19:16.523Z","updated_at":"2025-08-24T17:19:16.523Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29956195,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T22:53:01.873Z","status":"ssl_error","status_checked_at":"2026-02-28T22:52:50.699Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["ajv-validation","joi-validation","store-plugin","superstruct-validation","type-checking","validator","vue","vuex","vuex-plugin","yup-validation"],"created_at":"2024-11-12T14:21:20.762Z","updated_at":"2026-03-01T00:32:21.174Z","avatar_url":"https://github.com/tzsk.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# :gift: Vuex Store Validator\n![Vuex Store Validator](./assets/main.png)\n\n![Build](https://img.shields.io/github/workflow/status/tzsk/vuex-store-validator/Tests/master?logo=github\u0026style=for-the-badge)\n![Coveralls](https://img.shields.io/coveralls/github/tzsk/vuex-store-validator/master?logo=coveralls\u0026style=for-the-badge)\n[![npm](https://img.shields.io/npm/v/vuex-store-validator?logo=npm\u0026style=for-the-badge)](https://www.npmjs.com/package/vuex-store-validator)\n[![npm](https://img.shields.io/npm/dt/vuex-store-validator?logo=npm\u0026style=for-the-badge)](https://www.npmjs.com/package/vuex-store-validator)\n\nThis package helps you to validate how you mutate your Vuex store. You can say that it is a Validator for the mutations. You can easily validate the payload for each of your mutations, so that you can be sure of the integrity of your Store Data.\n\nThis package also has support for any custom schema validator you may choose. You can create your own implementation and extend this package to use that schema.\n\nThough Vuex allows you to set the store state directly without calling any mutation. This package won't validate anything outside the mutations.\n\n## :package: Installation\n\n```bash\n// NPM:\n$ npm install --save vuex-store-validator\n\n// Yarn:\n$ yarn add vuex-store-validator\n```\n\nBy default it comes with `Joi` validator. It also has support for `Superstruct` and `Yup` validation engine. Read their respective docs to find out which one is best for you.\n- [Joi Documentation](https://github.com/sideway/joi/blob/master/API.md)\n- [Superstruct Documentation](https://github.com/ianstormtaylor/superstruct/blob/master/Readme.md)\n- [Yup Documentation](https://github.com/jquense/yup/blob/master/README.md)\n\nIt did come with `Ajv` validation engine on `^1.0` but for the sake of bundle size it is removed from the bundle, but no need to worry, you can still make use of it by providing custom validator to the package.\n\n- [Ajv Documentation](https://github.com/ajv-validator/ajv/blob/master/README.md)\n\n#### Setup Joi\nIf you want to use joi then you'll have to install it as your project dependency.\n\n```bash\n// NPM:\n$ npm install --save joi\n\n// Yarn:\n$ yarn add joi\n```\n\n#### Setup Superstruct\nIf you want to use superstruct then you'll have to install it as your project dependency.\n\n```bash\n// NPM:\n$ npm install --save superstruct\n\n// Yarn:\n$ yarn add superstruct\n```\n\n#### Setup Yup\nIf you want to use yup then you'll have to install it as your project dependency.\n\n```bash\n// NPM:\n$ npm install --save yup\n\n// Yarn:\n$ yarn add yup\n```\n\n#### Setup Ajv\nIf you want to use ajv then you'll have to install it as your project dependency.\n\n```bash\n// NPM:\n$ npm install --save ajv\n\n// Yarn:\n$ yarn add ajv\n```\n\nAfter that, see how to setup `AJV` with this package here: [Custom Validator Usage](#boom-custom-validator-usage)\n\n## :fire: Usage\n\n1. Add the validator to the plugins section of your Root Store.\n\n```js\n// store.js\nimport VuexStoreValidator from 'vuex-store-validator';\n\nexport default new Vuex.Store({\n    ...\n    plugins: [new VuexStoreValidator()],\n});\n```\n\n2. Add Rules to your store and respective modules\n\n```js\n// store.js\nimport VuexStoreValidator, { ENGINE } from 'vuex-store-validator';\n\nexport default new Vuex.Store({\n    rules: {\n        SET_USER: ...SCHEMA HERE...\n    },\n    state: {user: null},\n    mutations: {\n        SET_USER(state, user) {\n            state.user = user;\n        }\n    },\n    plugins: [new VuexStoreValidator()],\n});\n\n// Joi Schema...\nimport Joi from 'joi';\nSET_USER: Joi.object({\n    name: Joi.string().required(),\n    age: Joi.number().required(),\n}).required(),\n\n// Superstruct Schema...\nimport {object, string, number} from 'superstruct';\nSET_USER: object({\n    name: string(),\n    age: number(),\n}),\n\n// Yup Schema...\nimport {object, string, number} from 'yup';\nSET_USER: object().shape({\n    name: string().required(),\n    age: number().required(),\n}).required(),\n```\n\n**NOTE:** If you want to use anything other than Joi then, you will have to add the engine option in the plugin registration\n```js\n// Superstruct...\nplugins: [new VuexStoreValidator({engine: ENGINE.SUPERSTRUCT})],\n\n// Yup...\nplugins: [new VuexStoreValidator({engine: ENGINE.YUP})],\n```\n\n### :tada: Congratulations! You're all done.\n\nNow whenever you call the mutation from anywhere be it inside an action or from any component. The payload you pass will be validated against the schema you've defined.\n\nFor the above piece of code if you try and call the `SET_USER` mutation without valid data:\n```js\n// From a Component\nthis.$store.commit('SET_USER', {name: 'John'});\n// Or from an action\nlogin({commit}, user) {\n    commit('SET_USER', {name: 'John'});\n}\n\n// Result: \n// ValidationError: \"email\" field is required for mutation: SET_USER\n```\n\nThis will work for all the nested modules as well. Just remember to add a new `rules` option to your module definition with state, action etc.\n\n### :star: Closure Support\n\nLet's face it, the real world projects are complex. It's not as straight forward as defining a schema. Sometimes you need to have conditional schema which depends on some other state property or the mutation payload itself.\n\nBut don't worry, you can even define the schema in a closure. You have 2 parameters available in that closure. The store and the mutation payload itself.\n\n**Example:**\n```js\nrules: {\n    SET_USER(store, data) {\n        // Store -\u003e Global Store instance\n        // Data -\u003e {name: 'John'}\n\n        return Joi.object({\n            ...\n        });\n    }\n}\n```\n\n### :muscle: Strict Mode\n\n#### What if you don't specify any schema for your Legacy Store?\n\nThat's not a problem at all. Your project will work as is. This package will only validate the ones for which you have specified a schema. Unless you are using this package in `Strict Mode`.\n\n```js\n// store.js\nimport VuexStoreValidator from 'vuex-store-validator';\n\nexport default new Vuex.Store({\n    ...\n    plugins: [new VuexStoreValidator({strict: true})],\n});\n```\n\nIf you set strict mode to `true`, then if you don't have a schema defined for any of your mutation, it will throw an exception.\n\n### :boom: Custom Validator Usage\n\n```js\nimport Ajv from 'ajv';\n\n// Define an async validator...\n/**\n * It accepts the schema and the data payload\n * It should throw an error if your validation fails OR\n * The return value should be the error string or null\n */\nconst ajvEngine = async (schema, data) =\u003e {\n  const ajv = new Ajv({ jsonPointers: true, $data: true });\n  const validate = ajv.compile(schema || {});\n\n  await validate(data);\n  if (validate.errors) {\n    throw new Error(validate.errors.map((item) =\u003e item.message).join(', '));\n  }\n};\n\n// Now extend with the custom validator...\nplugins: [\n    new VuexStoreValidator({\n        engine: 'ajv',\n        extend: {\n            ajv: ajvEngine,\n        },\n    })\n]\n\n// Make sure that the engine name and the extend key are the same\n\n// Now your schema would look something like this:\nrules: {\n    MUTATION_NAME: {\n        type: 'object',\n        properties: {\n            name: {\n                type: 'string',\n            },\n            age: {\n                type: 'number',\n            },\n        },\n        required: ['name', 'age'],\n    },\n}\n```\n\nYou can also leverage Vue PropType Validator and make your own implementation of that. Maybe even React PropType validator. Or anything you like.\n\n### :eyes: Caution\n\nThis package won't prevent you from setting invalid data to your store. But it will throw appropriate exception every time you set invalid data, so that you can be aware of where bad data might be coming from.\n\nYou can see and debug your code based on the Production Logs related to any bad data. If you are using Ignition or Sentry.\n\n## :microscope: Testing\n\nAfter Cloning the repository, install all npm dependencies by running: `npm install`.\n\nThen Run Tests:\n\n```bash\n$ npm run test\n```\n\n## :date: Change log\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## :heart: Contributing\n\nPlease feel free to contribute ideas and PRs are most welcome.\n\n## :crown: Credits\n\n- [Kazi Mainuddin Ahmed][link-author]\n- [All Contributors][link-contributors]\n\n## :policeman: License\n\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.\n\n[link-author]: https://github.com/tzsk\n[link-contributors]: ../../contributors\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftzsk%2Fvuex-store-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftzsk%2Fvuex-store-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftzsk%2Fvuex-store-validator/lists"}