Validation

Summary

Describes how pod configuration is validated

We use ajv to validate schemas.

  • location: src/utils.ts
  static validate<T>(config: Partial<T>, schema: JSONSchemaType<T>) {
    const validateConfig = ajv.compile(schema);
    const valid = validateConfig(config);
    if (!valid) {
      const errors = ajv.errorsText(validateConfig.errors);
      throw new DendronError({
        message: `validation errors: ${errors}`,
        payload: `error: ${JSON.stringify(validateConfig.errors)}`,
      });
    }
  }