From 8926d58e87c2777424aeefbe6b662ad0198e1197 Mon Sep 17 00:00:00 2001 From: Michael Kainz <michael.kainz@open-xchange.com> Date: Wed, 10 Apr 2024 11:06:52 +0200 Subject: [PATCH] Added ajv-formats for migration --- package.json | 3 ++- pnpm-lock.yaml | 14 ++++++++++++++ src/routes/webmanifest.js | 5 +++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 8ae0055..98b4ab6 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 611a0f7..443ffdb 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 3ba2949..20f04cf 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 -- GitLab