File validation

This commit is contained in:
1ilit
2023-09-19 15:49:28 +03:00
parent 423e4e9b2d
commit db843f32f3
5 changed files with 290 additions and 47 deletions

View File

@@ -1,3 +1,6 @@
import { Validator } from "jsonschema";
import { jsonSchema } from "../schemas";
const enterFullscreen = () => {
const element = document.documentElement;
if (element.requestFullscreen) {
@@ -23,4 +26,8 @@ const exitFullscreen = () => {
}
};
export { enterFullscreen, exitFullscreen };
const diagramObjectIsValid = (obj) => {
return new Validator().validate(obj, jsonSchema).valid;
};
export { enterFullscreen, exitFullscreen, diagramObjectIsValid };