UNPKG

@dappnode/schemas

Version:

A shared TypeScript JSON schemas and its validation functions for the manifest and setup wizard dappnode files

19 lines 738 B
import { ajv } from "./ajv.js"; import { CliError } from "./error.js"; import { processError } from "./utils.js"; import manifestSchema from "./schemas/manifest.schema.json" assert { type: "json" }; /** * Validates manifest file with schema * @param manifest */ export function validateManifestSchema(manifest) { const validateManifest = ajv.compile(manifestSchema); const valid = validateManifest(manifest); if (!valid) { const errors = validateManifest.errors ? validateManifest.errors.map((e) => processError(e, "manifest")) : []; throw new CliError(`Invalid manifest: \n${errors.map((msg) => ` - ${msg}`).join("\n")}`); } } //# sourceMappingURL=validateManifestSchema.js.map