Skip to content

Commit

Permalink
fix: include all formats by default
Browse files Browse the repository at this point in the history
  • Loading branch information
AVVS committed Dec 28, 2020
1 parent e0172e8 commit ba95155
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
},
"dependencies": {
"ajv": "^7.0.2",
"ajv-formats": "^1.5.1",
"ajv-keywords": "^4.0.0",
"callsite": "^1.0.0",
"common-errors": "^1.2.0",
Expand Down
8 changes: 6 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { URL } from 'url'
import Ajv, { ValidateFunction, Options } from 'ajv'
import keywords from 'ajv-keywords'
import addKeywords from 'ajv-keywords'
import addFormats from 'ajv-formats'
import callsite = require('callsite')
import { InvalidOperationError, io, NotFoundError } from 'common-errors'
import _debug = require('debug')
Expand Down Expand Up @@ -89,8 +90,11 @@ export class Validator {
}
})

addKeywords(ajvInstance)
addFormats(ajvInstance)

// save instance
this.$ajv = keywords(ajvInstance)
this.$ajv = ajvInstance

// automatically init if we have schema dir
if (schemaDir) {
Expand Down
9 changes: 8 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1296,6 +1296,13 @@ aggregate-error@^3.0.0:
clean-stack "^2.0.0"
indent-string "^4.0.0"

ajv-formats@^1.5.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/ajv-formats/-/ajv-formats-1.5.1.tgz#0f301b1b3846182f224cc563fc0a032daafb7dab"
integrity sha512-s1RBVF4HZd2UjGkb6t6uWoXjf6o7j7dXPQIL7vprcIT/67bTD6+5ocsU0UKShS2qWxueGDWuGfKHfOxHWrlTQg==
dependencies:
ajv "^7.0.0"

ajv-keywords@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-4.0.0.tgz#d0ffb23189d5002b234ad54c1a1b620a5398db58"
Expand All @@ -1311,7 +1318,7 @@ ajv@^6.10.0, ajv@^6.10.2, ajv@^6.12.3, ajv@^6.12.4:
json-schema-traverse "^0.4.1"
uri-js "^4.2.2"

ajv@^7.0.2:
ajv@^7.0.0, ajv@^7.0.2:
version "7.0.2"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-7.0.2.tgz#04ccc89a93449c64382fe0846d45a7135d986dbc"
integrity sha512-qIaxO9RXjaXyO21tJr0EvwPcZa49m64GcXCU8ZrLjCAlFyMuOcPpI560So4A11M1WsKslJYIXn6jSyG5P0xIeg==
Expand Down

0 comments on commit ba95155

Please sign in to comment.