From 01cd2f06bdc8736de87cc7d9e4f93e726fb9a073 Mon Sep 17 00:00:00 2001 From: szabolcsnagy <1876846+szabolcsnagy@users.noreply.github.com> Date: Tue, 4 Oct 2022 06:27:17 -0400 Subject: [PATCH] Add formats before ajv.compile - Initialize ajv-formats before compiling the schema to avoid `unknown format` warnings - exports the ajv object so the initialized schema can be used elsewhere --- src/generate/generate-compile-decoders.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/generate/generate-compile-decoders.ts b/src/generate/generate-compile-decoders.ts index c6ff00c..1945593 100644 --- a/src/generate/generate-compile-decoders.ts +++ b/src/generate/generate-compile-decoders.ts @@ -55,9 +55,9 @@ import { validateJson } from './validate'; import { $ModelImports } from './models'; import jsonSchema from './schema.json'; -const ajv = new Ajv({ strict: false }); -ajv.compile(jsonSchema); +export const ajv = new Ajv({ strict: false }); $Formats +ajv.compile(jsonSchema); // Decoders $Decoders