private static validateManifest()

in packages/aws-rfdk/lib/deadline/lib/stage.ts [138:164]


  private static validateManifest(rawManifest: any): rawManifest is Manifest {
    if (rawManifest !== undefined && typeof rawManifest !== 'object') {
      throw new TypeError(`Expected object but got ${typeof rawManifest}`);
    }
    const schema = rawManifest.schema;
    if (schema === undefined) {
      throw new Error('Manifest contains no "schema" key');
    } else if (typeof schema !== 'number') {
      throw new TypeError(`Expected a numeric "schema" but got: ${typeof schema}`);
    }

    const version = rawManifest.version;
    /* istanbul ignore else */
    if (version === undefined) {
      throw new Error('Manifest contains no "version" key');
    } else if (typeof version !== 'string') {
      throw new TypeError(`Expected a string "version" but got: ${typeof version}`);
    }

    // Do minimum supported deadline version check
    const stagedVersion = Version.parse(version);
    if (stagedVersion.isLessThan(Version.MINIMUM_SUPPORTED_DEADLINE_VERSION)) {
      throw new TypeError(`Staged Deadline Version (${version}) is less than the minimum supported version (${Version.MINIMUM_SUPPORTED_DEADLINE_VERSION.toString()})`);
    }

    return true;
  }