Registry / testing / jski
library0.6.1jsnpmunverified

A JSON Schema validator supporting a subset of JSON Schema v4 (draft 4). Version 0.6.1 is the latest stable release. It allows building schemas via method chaining or from plain JSON objects, and provides validation with detailed error objects. Key differentiators: lightweight, no dependencies, simple API. However, it has significant limitations: no union types, limited array/object additionalItems/Properties, no patternProperties, no dependencies, no $ref resolution beyond definitions, and no 'not' support. It is currently in maintenance mode with no recent updates.

npm install jski
INSTALL
IMPORT
SIG · JSKI
J
jski
testingjavascriptv0.6.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import jski from 'jski'
const J = require('jski'); var J = require('jski')()
The default export is a factory function that returns a J object. ESM import is possible but the package is primarily used with CommonJS.
J
const J = require('jski')()
const J = require('jski')
You must call require('jski')() to get the builder object; the require itself returns a factory function.
validate
J.number().validate(value)
J.number.validate(value)
validate is a method on the schema object, not on J. J.number() returns a schema instance.

Creates a validator using method chaining, validates an object, and logs errors if any.

const J = require('jski')(); const validator = J.object({ foo: J.number().minimum(0), bar: J.string().maxLength(10) }); const errors = validator.validate({ foo: 5, bar: 'hello' }); if (errors.length === 0) { console.log('Valid!'); } else { console.error(errors); }
Debug
Known issues
breakingjski does not support union types (anyOf/oneOf/not with type combinations) — anyOf/oneOf only work for schema objects, not types.
fix
Use a different validator like ajv if you need full JSON Schema v4/v7 support.
affects: >=0.0.0
gotchaadditionalItems in array and additionalProperties in object can only be true or false, not a schema.
fix
If you need schema-based additionalItems, use ajv or another validator.
affects: >=0.0.0
gotcha$ref resolution is limited to definitions in options.definitions or via .definitions() — no remote $ref or inline $ref support.
fix
Provide definitions explicitly in the options or use .definitions() on the schema.
affects: >=0.0.0
deprecatedjski has not been updated since 2016 and is not actively maintained. Consider using ajv for a modern, spec-compliant validator.
fix
Migrate to ajv (https://www.npmjs.com/package/ajv).
affects: >=0.0.0
breakingjski does not support patternProperties, dependencies, or 'not' keyword.
fix
Use ajv if your schema uses these features.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: J.number is not a function
Calling J.number() before initializing with factory: require('jski') returns a factory function, not J.
fix
Use const J = require('jski')() or const factory = require('jski'); const J = factory();
Cannot read property 'validate' of undefined
Calling .validate() on J itself instead of a schema instance.
fix
Ensure you build a schema first: const schema = J.number(); schema.validate(value);
Error: Unknown type: undefined
Passing an undefined value to J.object or J.array.
fix
Make sure all property schemas are defined: J.object({ foo: J.string() })
Upgrade
Version history
0.6.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Resources
packagejski
jski — npm install jski · libregistry