Skip to main content

Validating schema

Depot provides a test framework with the capability of validating namespaces. This confirms if the provided namespace conforms to schema definitions rules.

example.test.ts
import { namespaceIsValid } from "@stage-tech/depot-test/dist/schema-validation";
import * as pkg from "..";

const namespace = JSON.stringify(pkg.mergedSchemas, null, 2);

test("test namespace", () => {
expect(namespaceIsValid(namespace)).toBeTruthy();
});

If the namespace has any errors, the test will fail and an error will be printed to the console. For example, Schema implementation for object not found.