{"id":13783761,"url":"https://github.com/pandastrike/jsck","last_synced_at":"2025-04-05T17:08:04.877Z","repository":{"id":57284081,"uuid":"13079552","full_name":"pandastrike/jsck","owner":"pandastrike","description":"JSON Schema Compiled checK","archived":false,"fork":false,"pushed_at":"2017-07-21T19:54:54.000Z","size":362,"stargazers_count":158,"open_issues_count":16,"forks_count":14,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-03-29T16:10:00.962Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"CoffeeScript","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/pandastrike.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":"2013-09-24T23:46:11.000Z","updated_at":"2024-11-28T16:27:57.000Z","dependencies_parsed_at":"2022-09-10T10:00:51.864Z","dependency_job_id":null,"html_url":"https://github.com/pandastrike/jsck","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pandastrike%2Fjsck","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pandastrike%2Fjsck/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pandastrike%2Fjsck/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pandastrike%2Fjsck/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pandastrike","download_url":"https://codeload.github.com/pandastrike/jsck/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247369952,"owners_count":20927928,"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-08-03T19:00:30.258Z","updated_at":"2025-04-05T17:08:04.856Z","avatar_url":"https://github.com/pandastrike.png","language":"CoffeeScript","funding_links":[],"categories":["Who Uses the Test Suite","JSON Schema Validators"],"sub_categories":["Coffeescript"],"readme":"# JSON Schema Compiled checK\n\nJSCK is one of the fastest [JSON Schema](http://json-schema.org) validators for Node.js.\nIt supports JSON Schema drafts\n[3][draft3_doc] and\n[4][draft4_doc],\nwith a few caveats (see the [Coverage section](#coverage) below).\n\n\n## Installation and Usage\n\nInstall with NPM:\n\n    npm install --save jsck\n\n\nRequire:\n\n```coffee\nJSCK = require \"jsck\"\n```\n\nJSCK can create validators from multiple schemas, but this requires that\neach schema be identified with a URI in a top-level \"id\" field.  In many\ncases, only a single schema is needed, and there is no need to uniquely\nidentify the schema.  This is the easiest way to use JSCK, as it is a\ncommon pattern.\n\n\n```coffee\n# Construct a validator for a schema lacking an \"id\" declaration\n\njsck = new JSCK.draft4\n  type: \"object\"\n  properties:\n    user:\n      type: \"object\"\n      required: [\"login\"]\n      properties:\n        login:\n          type: \"string\"\n          pattern: \"^[\\\\w\\\\d_]{3,32}$\"\n        email:\n          type: \"string\"\n          format: \"email\"\n\nconsole.log \"valid document:\", jsck.validate\n  user:\n    login: \"matthew\"\n    email: \"matthew@pandastrike.com\"\n\n{errors} = jsck.validate\n  user:\n    login: \"matthew\"\n    email: \"pandastrike.com\"\n\nconsole.log \"invalid document:\", errors\n\n```\n\n\n\nTo use Draft 3 schemas:\n\n```.coffee\nvalidator = new JSCK.draft3(schema)\n```\n\n\nSee these [advanced usage examples](examples/draft4/advanced.coffee) for help\nworking with multiple schemas.\n\n\n\n## Why JSCK?\n\nJSCK is [faster](#benchmarks) than most other JavaScript/CoffeeScript libraries\nfor validating JSON Schemas because it \"compiles\" the schemas. That is, JSCK\ngenerates the tree of functions needed to validate a particular schema when you\nconstruct a validator. The schema is thus traversed only during preparation, and\nmost of the work of interpreting the schema is done at this time, rather than\nfor every document submitted for validation. This minimizes the work required\nduring validation, which leads to substantial performance improvements over\nnon-compiling validators.\n\n\n\n## Coverage\n\n### Draft 4\n\nJSCK passes all tests in the canonical\n[JSON Schema Test Suite][canonical], except for these items:\n\n* use of `maxLength` and `minLength` with Unicode surrogate pairs.\n* `refRemote` (this is an essential feature we do plan to support)\n* `ref`\n  * remote ref, containing refs itself\n* `uniqueItems`\n* `optional/zeroTerminatedFloats`\n\n\n### Draft 3\n\nCurrently passing the canonical [test suite][canonical] for draft3 except for\nthese items:\n\n* `refRemote`\n* `ref`\n  * remote ref, containing refs itself\n* `uniqueItems`\n* `optional/zeroTerminatedFloats`\n\n### Managing resolution scope with the \"id\" attribute\n\nJSCK does not support the full range of scope manipulations suggested by JSON\nSchema drafts 3 and 4.  Scope manipulation is a controversial topic, and with\nJSCK we have chosen to play it safe, supporting \"id\" declarations only in cases\nthat will (probably) not lead to any ambiguity. Specifically, JSCK uses \"id\"\ndeclarations only in these cases:\n\n* at the top level of a schema, to provide a namespace for schemas not loaded from URIs.\n* non-JSON-pointer fragments (`\"id\": \"#user\"`), which serve merely as aliases for specific subschemas, and are thus convenient and unambiguous.\n\nFor more information on the topic of the \"id\" attribute and scope manipulation,\nsee this issue: https://github.com/json-schema/json-schema/issues/77.\n\n\n## Contributing\n\nTo contribute, hack on it, or run the tests:\n\n```shell\ngit clone git@github.com:pandastrike/jsck.git\ncd jsck\ncoffee tasks/update\nnpm install\n```\n\n### Tests\n\nJSCK uses the official [JSON Schema Test Suite][canonical] as well as some\ncustom tests. To run all tests for all versions:\n\n    coffee test\n\nSee [this document](doc/tests.md) for more information on working with JSCK tests.\n\n\n## Benchmarks\n\nJSCK has fairly comprehensive benchmarks which show it to be one of the very\nfastest JSON Schema validators available for Node.js. Pull requests welcome, of\ncourse.\n\nBecause performance varies (at very least) based on the complexity\nof the schema being validated, we run benchmarks against several different\nschemas, ranging from quite simple to moderately complex.\n\nFor JSON Schema Draft4, we run benchmarks against JSCK, tv4, jayschema,\nz-schema, and other validators.  On the\n[trivial schema](benchmarks/draft4/trivial/schema.coffee),\nour benchmarks produce this relative performance for these validators\n(lower is better):\n\n```coffee\najv : 1\njsen : 2.9\nis-my-json-valid : 4.4\nThemis (minimal) : 5.2\nThemis : 5.3\nJSCK : 34.2\nz-schema : 48.3\ntv4 : 54.4\njayschema : 2507.4\n```\n\n\nFor the schema of [medium complexity](benchmarks/draft4/medium/schema.coffee),\nour benchmarks produce this relative performance for the tested validators\n(lower is better):\n\n```coffee\najv : 1\nis-my-json-valid : 2.8\njsen : 3.0\nThemis (minimal) : 11.1\nThemis : 11.6\nJSCK : 22.0\ntv4 : 43.4\nz-schema : 46.0\njayschema : 2319.4\n```\n\nFor the schema of [higher complexity](benchmarks/draft4/complex/schema.coffee),\nour benchmarks produce this relative performance for the tested validators\n(lower is better):\n\n```coffee\najv : 1\nis-my-json-valid : 1.23\njsen : 1.31\nThemis (minimal) : 1.7\nThemis : 1.8\nJSCK : 4.8\nz-schema : 17.2\ntv4 : 27.0\njayschema : 1215.1\n```\n\nAs the complexity of the schema increases, the performance benefits of the\ncompilation model become more evident.\n\n\nSee [this document](doc/benchmarks.md) for detailed results and information on\nrunning and creating benchmarks.\n\n\n\n[draft3_doc]:http://tools.ietf.org/html/draft-zyp-json-schema-03\n[draft3_impl]:https://github.com/json-schema/json-schema/tree/master/draft-03\n[draft4_doc]:http://tools.ietf.org/html/draft-zyp-json-schema-04\n[canonical]:https://github.com/json-schema/JSON-Schema-Test-Suite\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpandastrike%2Fjsck","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpandastrike%2Fjsck","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpandastrike%2Fjsck/lists"}