mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 21:32:56 -07:00
relax JSON schema validation (#9332)
Co-authored-by: Tommaso Sciortino <sciortino@gmail.com>
This commit is contained in:
@@ -9,7 +9,18 @@ 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();
|
||||
const ajValidator = new AjvClass(
|
||||
// See: https://ajv.js.org/options.html#strict-mode-options
|
||||
{
|
||||
// strictSchema defaults to true and prevents use of JSON schemas that
|
||||
// include unrecognized keywords. The JSON schema spec specifically allows
|
||||
// for the use of non-standard keywords and the spec-compliant behavior
|
||||
// is to ignore those keywords. Note that setting this to false also
|
||||
// allows use of non-standard or custom formats (the unknown format value
|
||||
// will be logged but the schema will still be considered valid).
|
||||
strictSchema: false,
|
||||
},
|
||||
);
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const addFormatsFunc = (addFormats as any).default || addFormats;
|
||||
addFormatsFunc(ajValidator);
|
||||
|
||||
Reference in New Issue
Block a user