{"id":20027082,"url":"https://github.com/unic/gulp-data-validate","last_synced_at":"2025-03-02T04:41:16.733Z","repository":{"id":42924884,"uuid":"243709482","full_name":"unic/gulp-data-validate","owner":"unic","description":"Validate data files against their respective JSON schemas","archived":false,"fork":false,"pushed_at":"2023-01-07T21:30:02.000Z","size":354,"stargazers_count":0,"open_issues_count":7,"forks_count":1,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-02-25T17:11:25.560Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://npmjs.com/gulp-data-validate","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/unic.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":"2020-02-28T08:03:28.000Z","updated_at":"2020-11-12T13:52:53.000Z","dependencies_parsed_at":"2023-02-08T02:18:26.220Z","dependency_job_id":null,"html_url":"https://github.com/unic/gulp-data-validate","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unic%2Fgulp-data-validate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unic%2Fgulp-data-validate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unic%2Fgulp-data-validate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unic%2Fgulp-data-validate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unic","download_url":"https://codeload.github.com/unic/gulp-data-validate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241460057,"owners_count":19966516,"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-13T09:08:59.201Z","updated_at":"2025-03-02T04:41:16.714Z","avatar_url":"https://github.com/unic.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gulp-data-validate\n\n[![latest version on npm](https://img.shields.io/npm/v/gulp-data-validate)](https://www.npmjs.com/package/gulp-data-validate)\n[![npm downloads a month](https://img.shields.io/npm/dm/gulp-data-validate)](https://www.npmjs.com/package/gulp-data-validate)\n[![required node version](https://img.shields.io/node/v/gulp-data-validate)](https://github.com/nodejs/Release)\n[![package license](https://img.shields.io/npm/l/gulp-data-validate)](license)\n\n\u003e Validate data files against their respective JSON schemas\n\nUses [`ajv`](https://github.com/epoberezkin/ajv), [`json-schema-ref-parser`](https://github.com/APIDevTools/json-schema-ref-parser) and [`import-fresh`](https://github.com/sindresorhus/import-fresh) under the hood.\n\n## How\nHave a `*.data.js` and a `*.schema.json` file for your module on the same level. Pass in the data file to the plugin, and, boom: See whether it's valid. If it's not, it'll log what's to be done.\n\n```bash\nyarn add gulp-data-validate --dev\n```\n\n```\nv modules\n  v my-module\n    \u003e my-module.hbs\n    \u003e my-module.scss\n    \u003e my-module.js\n    \u003e my-module.data.js\n    \u003e my-module.schema.json\n  \u003e my-other-module\n  \u003e another-one\n  \u003e best-module\n```\n\n```js\nconst { src } = require('gulp');\nconst validate = require('gulp-data-validate');\n\nmodule.exports.schema = src('modules/**/*.data.js').pipe(validate());\n```\n\n## Options\nYou can pass in an object containing three keys: `schemaSuffix`, `failOnError` and `ignorePrefix`. With those three, you can adapt to your naming scheme and control whether the build should fail when the data files aren't valid.\n\n```js\nconst defaultOptions = {\n  schemaSuffix: '.schema.json',\n  failOnError: false,\n  ignorePrefix: '_'\n};\n```\n\nIf your schemas are just named `*.json`, you want to skip schema validation for files beginning with `_` and you want the build to fail on error (nice for CI-purposes), your folder structure and config would look like this:\n\n```\nv modules\n  v my-module\n    \u003e my-module.hbs\n    \u003e my-module.scss\n    \u003e my-module.js\n    \u003e my-module.data.js\n    \u003e my-module.json\n    v partials\n      _my-partial.hbs\n      _my-partial.scss\n      _my-partial.data.js\n  \u003e my-other-module\n  \u003e another-one\n  \u003e best-module\n```\n\n```js\nconst { src } = require('gulp');\nconst validate = require('gulp-data-validate');\n\nmodule.exports.schema = src('modules/**/*.data.js').pipe(validate({\n  schemaSuffix: '.json',\n  failOnError: true,\n  ignorePrefix: '_'\n}));\n```\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funic%2Fgulp-data-validate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funic%2Fgulp-data-validate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funic%2Fgulp-data-validate/lists"}