Skip to content

Commit

Permalink
Merge branch 'master' into fix-broken-links
Browse files Browse the repository at this point in the history
  • Loading branch information
jasoniangreen committed Mar 9, 2024
2 parents 5e10151 + 45685de commit 4afa885
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 47 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
node-version: [14.x, 16.x, 18.x, 19.x]
node-version: [16.x, 18.x, 20.x, 21.x]

steps:
- uses: actions/checkout@v2
Expand All @@ -23,7 +23,7 @@ jobs:
- run: npm install
- run: git submodule update --init
- name: update website
if: ${{ github.event_name == 'push' && matrix.node-version == '14.x' }}
if: ${{ github.event_name == 'push' && matrix.node-version == '16.x' }}
run: ./scripts/publish-site
env:
GH_TOKEN_PUBLIC: ${{ secrets.GH_TOKEN_PUBLIC }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -12,7 +12,7 @@ Supports JSON Schema draft-04/06/07/2019-09/2020-12 ([draft-04 support](https://
[![npm](https://img.shields.io/npm/v/ajv.svg)](https://www.npmjs.com/package/ajv)
[![npm downloads](https://img.shields.io/npm/dm/ajv.svg)](https://www.npmjs.com/package/ajv)
[![Coverage Status](https://coveralls.io/repos/github/ajv-validator/ajv/badge.svg?branch=master)](https://coveralls.io/github/ajv-validator/ajv?branch=master)
[![SimpleX](https://img.shields.io/badge/chat-on%20SimpleX-%2307b4b9)](https://simplex.chat/contact#/?v=1-2&smp=smp%3A%2F%2Fu2dS9sG8nMNURyZwqASV4yROM28Er0luVTx5X1CsMrU%3D%40smp4.simplex.im%2FV-6t4hoy_SsvKMi9KekdGX-VKQOhDeAe%23%2F%3Fv%3D1-2%26dh%3DMCowBQYDK2VuAyEAm98gjwvrAEiiz_YgBoaQB9dtKTl5Om1pborUyevQwzg%253D%26srv%3Do5vmywmrnaxalvz6wi3zicyftgio6psuvyniis6gco6bp6ekl4cqj4id.onion&data=%7B%22type%22%3A%22group%22%2C%22groupLinkId%22%3A%22wYrTFafovkymjUtc2vUjCQ%3D%3D%22%7D)
[![SimpleX](https://img.shields.io/badge/chat-on%20SimpleX-70F0F9)](https://simplex.chat/contact#/?v=1-2&smp=smp%3A%2F%2Fu2dS9sG8nMNURyZwqASV4yROM28Er0luVTx5X1CsMrU%3D%40smp4.simplex.im%2F8KvvURM6J38Gdq9dCuPswMOkMny0xCOJ%23%2F%3Fv%3D1-2%26dh%3DMCowBQYDK2VuAyEAr8rPVRuMOXv6kwF2yUAap-eoVg-9ssOFCi1fIrxTUw0%253D%26srv%3Do5vmywmrnaxalvz6wi3zicyftgio6psuvyniis6gco6bp6ekl4cqj4id.onion&data=%7B%22type%22%3A%22group%22%2C%22groupLinkId%22%3A%224pwLRgWHU9tlroMWHz0uOg%3D%3D%22%7D)
[![Gitter](https://img.shields.io/gitter/room/ajv-validator/ajv.svg)](https://gitter.im/ajv-validator/ajv)
[![GitHub Sponsors](https://img.shields.io/badge/$-sponsors-brightgreen)](https://github.com/sponsors/epoberezkin)

Expand Down
2 changes: 1 addition & 1 deletion docs/options.md
Expand Up @@ -240,7 +240,7 @@ An array or object of schemas that will be added to the instance. In case you pa

### logger

Sets the logging method. Default is the global `console` object that should have methods `log`, `warn` and `error`. See [Error logging](#error-logging).
Sets the logging method. Default is the global `console` object that should have methods `log`, `warn` and `error`. See [Error logging](./api.md#error-logging).

Option values:

Expand Down
2 changes: 1 addition & 1 deletion docs/security.md
Expand Up @@ -93,7 +93,7 @@ If you use Ajv to validate data from untrusted sources **it is strongly recommen

- making assessment of "format" implementations in [ajv-formats](https://github.com/ajv-validator/ajv-formats).
- passing `"fast"` option to ajv-formats plugin (see its docs) that simplifies some of the regular expressions (although it does not guarantee that they are safe).
- replacing format implementations provided by ajv-formats with your own implementations of "format" keyword that either use different regular expressions or another approach to format validation. Please see [addFormat](#api-addformat) method.
- replacing format implementations provided by ajv-formats with your own implementations of "format" keyword that either use different regular expressions or another approach to format validation. Please see [addFormat](https://github.com/ajv-validator/ajv/blob/master/docs/api.md#api-addformat) method.
- disabling format validation by ignoring "format" keyword with option `format: false`

Whatever mitigation you choose, please assume all formats provided by ajv-formats as potentially unsafe and make your own assessment of their suitability for your validation scenarios.
Expand Down
8 changes: 4 additions & 4 deletions lib/compile/resolve.ts
Expand Up @@ -102,16 +102,16 @@ export function getSchemaRefs(this: Ajv, schema: AnySchema, baseId: string): Loc
traverse(schema, {allKeys: true}, (sch, jsonPtr, _, parentJsonPtr) => {
if (parentJsonPtr === undefined) return
const fullPath = pathPrefix + jsonPtr
let baseId = baseIds[parentJsonPtr]
if (typeof sch[schemaId] == "string") baseId = addRef.call(this, sch[schemaId])
let innerBaseId = baseIds[parentJsonPtr]
if (typeof sch[schemaId] == "string") innerBaseId = addRef.call(this, sch[schemaId])
addAnchor.call(this, sch.$anchor)
addAnchor.call(this, sch.$dynamicAnchor)
baseIds[jsonPtr] = baseId
baseIds[jsonPtr] = innerBaseId

function addRef(this: Ajv, ref: string): string {
// eslint-disable-next-line @typescript-eslint/unbound-method
const _resolve = this.opts.uriResolver.resolve
ref = normalizeId(baseId ? _resolve(baseId, ref) : ref)
ref = normalizeId(innerBaseId ? _resolve(innerBaseId, ref) : ref)
if (schemaRefs.has(ref)) throw ambiguos(ref)
schemaRefs.add(ref)
let schOrRef = this.refs[ref]
Expand Down
3 changes: 2 additions & 1 deletion lib/runtime/parseJson.ts
@@ -1,4 +1,4 @@
const rxParseJson = /position\s(\d+)$/
const rxParseJson = /position\s(\d+)(?: \(line \d+ column \d+\))?$/

export function parseJson(s: string, pos: number): unknown {
let endPos: number | undefined
Expand Down Expand Up @@ -129,6 +129,7 @@ export function parseJsonString(s: string, pos: number): string | undefined {
while (count--) {
code <<= 4
c = s[pos]
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (c === undefined) {
errorMessage("unexpected end")
return undefined
Expand Down
74 changes: 37 additions & 37 deletions package.json
Expand Up @@ -58,53 +58,53 @@
"homepage": "https://ajv.js.org",
"runkitExampleFilename": ".runkit_example.js",
"dependencies": {
"fast-deep-equal": "^3.1.1",
"fast-deep-equal": "^3.1.3",
"json-schema-traverse": "^1.0.0",
"require-from-string": "^2.0.2",
"uri-js": "^4.2.2"
"uri-js": "^4.4.1"
},
"devDependencies": {
"@ajv-validator/config": "^0.3.0",
"@rollup/plugin-commonjs": "^24.0.0",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-typescript": "^10.0.1",
"@types/chai": "^4.2.12",
"@types/mocha": "^10.0.0",
"@types/node": "^18.11.9",
"@types/require-from-string": "^1.2.0",
"@typescript-eslint/eslint-plugin": "^3.8.0",
"@typescript-eslint/parser": "^3.8.0",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-typescript": "^11.1.6",
"@types/chai": "^4.3.11",
"@types/mocha": "^10.0.6",
"@types/node": "^20.11.19",
"@types/require-from-string": "^1.2.3",
"@typescript-eslint/eslint-plugin": "^3.10.1",
"@typescript-eslint/parser": "^3.10.1",
"ajv-formats": "^3.0.0-rc.0",
"browserify": "^17.0.0",
"chai": "^4.0.1",
"cross-env": "^7.0.2",
"dayjs": "^1.10.4",
"chai": "^4.4.1",
"cross-env": "^7.0.3",
"dayjs": "^1.11.10",
"dayjs-plugin-utc": "^0.1.2",
"eslint": "^7.8.1",
"eslint-config-prettier": "^7.0.0",
"fast-uri": "^2.1.0",
"glob": "^8.0.2",
"husky": "^8.0.2",
"if-node-version": "^1.0.0",
"jimp": "^0.16.1",
"js-beautify": "^1.7.3",
"eslint": "^7.32.0",
"eslint-config-prettier": "^7.2.0",
"fast-uri": "^2.3.0",
"glob": "^10.3.10",
"husky": "^9.0.11",
"if-node-version": "^1.1.1",
"jimp": "^0.22.10",
"js-beautify": "^1.15.1",
"json-schema-test": "^2.0.0",
"karma": "^6.0.0",
"karma-chrome-launcher": "^3.0.0",
"karma-mocha": "^2.0.0",
"lint-staged": "^13.0.3",
"mocha": "^10.0.0",
"module-from-string": "^3.1.3",
"node-fetch": "^3.0.0",
"nyc": "^15.0.0",
"prettier": "^2.3.1",
"re2": "^1.16.0",
"rollup": "^2.44.0",
"karma": "^6.4.2",
"karma-chrome-launcher": "^3.2.0",
"karma-mocha": "^2.0.1",
"lint-staged": "^15.2.2",
"mocha": "^10.3.0",
"module-from-string": "^3.3.0",
"node-fetch": "^3.3.2",
"nyc": "^15.1.0",
"prettier": "^2.8.8",
"re2": "^1.20.9",
"rollup": "^2.79.1",
"rollup-plugin-terser": "^7.0.2",
"ts-node": "^10.0.0",
"tsify": "^5.0.2",
"typescript": "^4.8.0"
"ts-node": "^10.9.2",
"tsify": "^5.0.4",
"typescript": "^4.9.5"
},
"collective": {
"type": "opencollective",
Expand Down

0 comments on commit 4afa885

Please sign in to comment.