{"id":19312402,"url":"https://github.com/offen/schemaify","last_synced_at":"2025-04-22T15:32:29.728Z","repository":{"id":57132823,"uuid":"280162244","full_name":"offen/schemaify","owner":"offen","description":"Browserify transform for compiling JSON schemas at build time using AJV","archived":false,"fork":false,"pushed_at":"2024-02-24T20:09:56.000Z","size":13,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-01T09:46:07.228Z","etag":null,"topics":["ajv","browserify-transform","json-schema"],"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/offen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.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-07-16T13:32:22.000Z","updated_at":"2022-09-05T23:26:17.000Z","dependencies_parsed_at":"2022-09-03T11:42:36.334Z","dependency_job_id":null,"html_url":"https://github.com/offen/schemaify","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/offen%2Fschemaify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/offen%2Fschemaify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/offen%2Fschemaify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/offen%2Fschemaify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/offen","download_url":"https://codeload.github.com/offen/schemaify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223900337,"owners_count":17222028,"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":["ajv","browserify-transform","json-schema"],"created_at":"2024-11-10T00:34:40.140Z","updated_at":"2024-11-10T00:34:40.955Z","avatar_url":"https://github.com/offen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://www.offen.software/\"\u003e\n  \u003cimg src=\"https://offen.github.io/press-kit/avatars/avatar-OS-header.svg\" alt=\"offen.software logo\" title=\"offen.software\" width=\"60px\"/\u003e\n\u003c/a\u003e\n\n# schemaify\n\nBrowserify transform for compiling JSON schemas at build time using AJV and `ajv-pack`\n\n## Installation\n\nThe package is released to npm as `@offen/schemaify`:\n\n```\nnpm install @offen/schemaify -D\n```\n\n## Usage\n\nIn the default configuration, the transform is applied to all files with a `.schema` extension. The transformed module will export the packed AJV `validate` function.\n\nIn your application:\n\n```js\nvar validateFoo = require('./foo.schema')\n\nvar ok = validateFoo({ foo: true })\nif (!ok) {\n  console.log(validateFoo.errors)\n  throw new Error('Foo did not validate')\n}\n```\n\nWhen bundling:\n\n```js\nvar browserify = require('browserify')\n\nvar b = browserify()\nb.add('app.js')\nb.transform('@offen/schemaify')\nb.bundle(function (err, src) {\n  // consume bundle\n})\n```\n\n### Defining schemas\n\nSchemas are expected to be defined in JSON format and saved as `.schema` files:\n\n```json\n{\n  \"type\": \"string\",\n  \"maxLength\": 128\n}\n```\n\n## Options\n\nThe transform accepts the following options as its 2nd arguments:\n\n### `secure`\n\nBy default, `schemaify` only compiles [\"secure\" schemas][secure]. This can be disabled by passing `secure: false` to the transform.\n\n[secure]: https://github.com/ajv-validator/ajv/tree/521c3a53f15f5502fb4a734194932535d311267c#security-considerations\n\n### `matcher`\n\nBy default, `schemaify` only compiles files with a `.schema` extension. If you have different requirements you can pass a Regexp string to `matcher` for the transform to use.\n\n**Important caveat**: Due to the way that Browserify handles JSON files, you currently __cannot use `.json` files__ for storing your schemas, as this would make these files subject to another set of rules that would conflict with.\n\n## Releasing a new version\n\nNew versions can be released using `npm version \u003cpatch|minor|major\u003e`. Make sure you are authenticated against the `@offen` scope with npm.\n\n## License\n\nCopyright 2020 Frederik Ring - Available under the MIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foffen%2Fschemaify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foffen%2Fschemaify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foffen%2Fschemaify/lists"}