mirror of
https://github.com/Unleash/unleash.git
synced 2025-08-04 13:48:56 +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>(
|
export const validateSchema = <S = SchemaId>(
|
||||||
schema: S,
|
schema: S,
|
||||||
data: unknown,
|
data: unknown,
|
||||||
|
Loading…
Reference in New Issue
Block a user