mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-26 13:48:33 +02:00
Ability to add AJV schemas runtime (#2792)
This commit is contained in:
parent
2139d8342a
commit
7a1c18bd35
@ -21,6 +21,13 @@ const ajv = new Ajv({
|
||||
},
|
||||
});
|
||||
|
||||
export const addAjvSchema = (schemaObjects: any[]): any => {
|
||||
const newSchemas = schemaObjects.filter(
|
||||
(schema) => !ajv.getSchema(schema.$id),
|
||||
);
|
||||
return ajv.addSchema(newSchemas);
|
||||
};
|
||||
|
||||
export const validateSchema = <S = SchemaId>(
|
||||
schema: S,
|
||||
data: unknown,
|
||||
|
Loading…
Reference in New Issue
Block a user