mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
Support JSON schema formats using ajv-formats (#6949)
This commit is contained in:
@@ -5,10 +5,14 @@
|
||||
*/
|
||||
|
||||
import AjvPkg from 'ajv';
|
||||
import * as addFormats from 'ajv-formats';
|
||||
// Ajv's ESM/CJS interop: use 'any' for compatibility as recommended by Ajv docs
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const AjvClass = (AjvPkg as any).default || AjvPkg;
|
||||
const ajValidator = new AjvClass();
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const addFormatsFunc = (addFormats as any).default || addFormats;
|
||||
addFormatsFunc(ajValidator);
|
||||
|
||||
/**
|
||||
* Simple utility to validate objects against JSON Schemas
|
||||
|
||||
Reference in New Issue
Block a user