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.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”filePath
Section titled “filePath”string
The file to read. Its name appears in the error on a schema violation.
schema
Section titled “schema”ZodType<T>
The schema to validate against.
Returns
Section titled “Returns”Promise<T>
The validated contents.
Throws
Section titled “Throws”With one bullet per schema issue, via validateWithSchema.
Throws
Section titled “Throws”If the file can’t be read — callers check for ENOENT to
treat a missing file as non-fatal.
Throws
Section titled “Throws”If the file isn’t valid JSON.