diff --git a/package.json b/package.json index 8ae0055d2fb32c40bd7859273d26e0a52187684d..98b4ab6730d1baa8e654fdc74b66128b8a7d797f 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "@fastify/swagger-ui": "^3.0.0", "@fastify/url-data": "^5.4.0", "ajv": "^8.0.0", + "ajv-formats": "^3.0.1", "bull": "^4.12.2", "dotenv-defaults": "^5.0.2", "fastify": "^4.26.2", @@ -98,4 +99,4 @@ "recursive": true }, "packageManager": "pnpm@8.15.6" -} +} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 611a0f7adce5fb789573a3b2d6f12f26d37f8707..443ffdb55bd6727dd0d947762ec53e50d5b16741 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -37,6 +37,9 @@ dependencies: ajv: specifier: ^8.0.0 version: 8.12.0 + ajv-formats: + specifier: ^3.0.1 + version: 3.0.1(ajv@8.12.0) bull: specifier: ^4.12.2 version: 4.12.2 @@ -518,6 +521,17 @@ packages: ajv: 8.12.0 dev: false + /ajv-formats@3.0.1(ajv@8.12.0): + resolution: {integrity: sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==} + peerDependencies: + ajv: ^8.0.0 + peerDependenciesMeta: + ajv: + optional: true + dependencies: + ajv: 8.12.0 + dev: false + /ajv@6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} dependencies: diff --git a/src/routes/webmanifest.js b/src/routes/webmanifest.js index 3ba29498dba8d501fe3936c1350c1773f4796aca..20f04cfedfd0bfe3defd9f11c0350ab70328583f 100644 --- a/src/routes/webmanifest.js +++ b/src/routes/webmanifest.js @@ -18,20 +18,21 @@ * Any use of the work other than as authorized under this license or copyright law is prohibited. */ -import { get } from '../cache.js' import Ajv from 'ajv' import fs from 'node:fs' +import addFormats from 'ajv-formats' +import { get } from '../cache.js' import { getRedisKey } from '../util.js' const appRoot = process.env.APP_ROOT const ajv = new Ajv({ allErrors: true }) - ajv.addSchema( fs.readdirSync('src/schemas/', 'utf8').map(file => { return JSON.parse(fs.readFileSync(`src/schemas/${file}`, 'utf8')) }) ) +addFormats(ajv) const template = { // custom values