Skip to content

loadValidatedJsonFile

loadValidatedJsonFile<T>(filePath, schema): Promise<T>

Defined in: packages/simply-cicd-core/src/deploy/deployCommon.ts:81

Read a JSON file and validate it against a zod schema.

T

string

The file to read. Its name appears in the error on a schema violation.

ZodType<T>

The schema to validate against.

Promise<T>

The validated contents.

With one bullet per schema issue, via validateWithSchema.

If the file can’t be read — callers check for ENOENT to treat a missing file as non-fatal.

If the file isn’t valid JSON.