def validate()

in marketplace/deployer_util/config_helper.py [0:0]


  def validate(self):
    """
    Fully validates the schema, raising InvalidSchema if fails.

    Intended for backward-incompatible validations that should only be
    enforced upon base deployer update, as opposed to validations added
    in class construction which are enforced immediately upon tools repo
    release.
    """
    bad_required_names = [
        x for x in self._required if x not in self._properties
    ]
    if bad_required_names:
      raise InvalidSchema(
          'Undefined property names found in required: {}'.format(
              ', '.join(bad_required_names)))

    is_v2 = False
    if self._x_google_marketplace is not None:
      self._x_google_marketplace.validate()
      is_v2 = self._x_google_marketplace.is_v2()

    if not is_v2 and self._app_api_version is None:
      raise InvalidSchema('applicationApiVersion is required')

    if len(self.form) > 1:
      raise InvalidSchema('form must not contain more than 1 item.')

    for item in self.form:
      if 'widget' not in item:
        raise InvalidSchema('form items must have a widget.')
      if item['widget'] not in WIDGET_TYPES:
        raise InvalidSchema('Unrecognized form widget: {}'.format(
            item['widget']))
      if 'description' not in item:
        raise InvalidSchema('form items must have a description.')

    if is_v2:
      for _, p in self._properties.items():
        if p.xtype == XTYPE_IMAGE:
          raise InvalidSchema(
              'No properties should have x-google-marketplace.type=IMAGE in '
              'schema v2. Images must be declared in the top level '
              'x-google-marketplace.images')
      if self._x_google_marketplace._deployer_service_account:
        self._x_google_marketplace._deployer_service_account.validate()

    for _, p in self._properties.items():
      if p.xtype == XTYPE_SERVICE_ACCOUNT:
        p.service_account.validate()