ajv-keywords
ajv-keywords copied to clipboard
Additional JSON-Schema keywords for Ajv JSON validator
Just jotting down notes for after https://github.com/epoberezkin/ajv-keywords/pull/64 is merged - [ ] Allow options, similar to `dynamicDefaults` - [ ] `toEnumCase` have option to ignore certain char when determining uniqueness...
According to $schema keyword [definition](https://json-schema.org/understanding-json-schema/reference/schema.html) the official `{ "$schema": "http://json-schema.org/draft/..." }` declarations should not be used with schemas containing custom keywords. Does AJV have a recommended $schema URI for use...
The examples of how to add a custom uuid function dynamicDefaults wrap `uuid.v4()`. However, I'd expect to be able to use either just `uuid` (which calls `uuid.v4`) or `uuid.v4` itself,...
TypeScript input: ``` import * as Ajv from 'ajv'; import * as AjvKeywords from 'ajv-keywords'; const ajv = new Ajv({ $data: true, messages: true, verbose: true, allErrors: true }); AjvKeywords(ajv);...
Using the next example: const Ajv = require('ajv'); require('ajv-keywords')(ajv, 'uniqueItemProperties'); const schema = { uniqueItemProperties: ['id', 'name'] }; var invalidData2 = [ { id: 1, name: 'taco' }, { id:...
`dynamicDefaults` allow users to add their own defaults functions by exporting `DEFAULTS` in the keyword, as so: https://github.com/epoberezkin/ajv-keywords/blob/master/keywords/dynamicDefaults.js#L49 However, `transform` does not export the transform variable - https://github.com/epoberezkin/ajv-keywords/blob/master/keywords/transform.js#L4 - and...
Example code below throws the following error when it attempts to compile selectSchema2: ``` /Users/sirockin/source/f2/f2-schema/node_modules/ajv/lib/dotjs/ref.js:61 throw new it.MissingRefError(it.baseId, $schema, $message); ^ Error: can't resolve reference defs.json#/definitions/int from id # ```...
toCapitalize: Convert the first word of each thread into a capital letter. trimSpaces: Eliminate double / triple / ... spaces leaving them to only one Thanks!
When you create a `Date` object in UTC timezone in JavaScript as follows ```js new Date(10000, null) ``` and convert it to ISO string, you get `+010000-01-01T00:00:00.000Z` (notice the leading...