示例#1
0
 def validate(self) -> bool:
     if not bool(self.trait_name):
         logger.error(
             self._TAG, self.ctx,
             Errors.validate_error_string(self.at_corpus_path,
                                          ['trait_name']))
         return False
     return True
 def validate(self) -> bool:
     if not bool(self.root_location):
         logger.error(
             self._TAG, self.ctx,
             Errors.validate_error_string(self.at_corpus_path,
                                          ['root_location']))
         return False
     return True
示例#3
0
 def validate(self) -> bool:
     if not bool(self.named_reference or self.explicit_reference):
         logger.error(
             self._TAG, self.ctx,
             Errors.validate_error_string(
                 self.at_corpus_path,
                 ['named_reference', 'explicit_reference'], True))
         return False
     return True
    def validate(self) -> bool:
        missing_fields = []
        if not bool(self.entity_name):
            missing_fields.append('entity_name')
        if not bool(self.entity_path):
            missing_fields.append('entity_path')

        if missing_fields:
            logger.error(self._TAG, self.ctx, Errors.validate_error_string(self.at_corpus_path, missing_fields))
            return False
        return True
示例#5
0
    def validate(self) -> bool:
        missing_fields = []

        if not bool(self.include_attributes):
            missing_fields.append('include_attributes')

        if len(missing_fields) > 0:
            logger.error(self._TAG, self.ctx, Errors.validate_error_string(self.at_corpus_path, missing_fields))
            return False

        return True
    def validate(self) -> bool:
        missing_fields = []

        if not bool(self.rename_format):
            missing_fields.append('rename_format')

        if len(missing_fields) > 0:
            logger.error(self._TAG, self.ctx, Errors.validate_error_string(self.at_corpus_path, missing_fields))
            return False

        return True
示例#7
0
    def validate(self) -> bool:
        missing_fields = []
        if not bool(self.manifest_name):
            missing_fields.append('manifest_name')
        if not bool(self.definition):
            missing_fields.append('definition')

        if missing_fields:
            logger.error(
                self._TAG, self.ctx,
                Errors.validate_error_string(self.at_corpus_path,
                                             missing_fields))
            return False
        return True
    def validate(self) -> bool:
        missing_fields = []

        if self.select is None:
            missing_fields.append('select')

        if not (self.merge_into):
            missing_fields.append('merge_into')

        if len(missing_fields) > 0:
            logger.error(self._TAG, self.ctx, Errors.validate_error_string(self.at_corpus_path, missing_fields))
            return False

        return True
 def validate(self) -> bool:
     if self.constant_values is None:
         path_split = self._declared_path.split('/')
         entity_name = path_split[0] if path_split else ''
         logger.warning(
             self._TAG, self.ctx,
             'constant entity \'{}\' defined without a constant value.'.
             format(entity_name))
     if not bool(self.entity_shape):
         logger.error(
             self._TAG, self.ctx,
             Errors.validate_error_string(self.at_corpus_path,
                                          ['entity_shape']))
         return False
     return True
示例#10
0
    def validate(self) -> bool:
        missing_fields = []
        if not bool(self.from_entity):
            missing_fields.append('from_entity')
        if not bool(self.from_entity_attribute):
            missing_fields.append('from_entity_attribute')
        if not bool(self.to_entity):
            missing_fields.append('to_entity')
        if not bool(self.to_entity_attribute):
            missing_fields.append('to_entity_attribute')

        if missing_fields:
            logger.error(self._TAG, self.ctx, Errors.validate_error_string(self.at_corpus_path, missing_fields))
            return False
        return True
    def validate(self) -> bool:
        missing_fields = []

        if self.start_ordinal is None:
            missing_fields.append('start_ordinal')

        if self.end_ordinal is None:
            missing_fields.append('end_ordinal')

        if len(missing_fields) > 0:
            logger.error(
                self._TAG, self.ctx,
                Errors.validate_error_string(self.at_corpus_path,
                                             missing_fields))
            return False

        return True
示例#12
0
    def validate(self) -> bool:
        missing_fields = []

        if not self.source:
            root_owner = self._get_root_owner()
            if root_owner.object_type != CdmObjectType.TYPE_ATTRIBUTE_DEF:
                # If the projection is used in an entity attribute or an extends entity
                missing_fields.append('source')
        elif not self.source.explicit_reference or self.source.explicit_reference.object_type != CdmObjectType.PROJECTION_DEF:
            # If reached the inner most projection
            root_owner = self._get_root_owner()
            if root_owner.object_type == CdmObjectType.TYPE_ATTRIBUTE_DEF:
                # If the projection is used in a type attribute
                logger.error(self._TAG, self.ctx, 'Source can only be another projection in a type attribute.', 'validate')

        if len(missing_fields) > 0:
            logger.error(self._TAG, self.ctx, Errors.validate_error_string(self.at_corpus_path, missing_fields))
            return False

        return True
    def validate(self) -> bool:
        missing_fields = []
        if not bool(self.name):
            missing_fields.append('name')
        if bool(self.cardinality):
            if not bool(self.cardinality.minimum):
                missing_fields.append('cardinality.minimum')
            if not bool(self.cardinality.maximum):
                missing_fields.append('cardinality.maximum')

        if missing_fields:
            logger.error(self._TAG, self.ctx, Errors.validate_error_string(self.at_corpus_path, missing_fields))
            return False

        if bool(self.cardinality):
            if not CardinalitySettings._is_minimum_valid(self.cardinality.minimum):
                logger.error(self._TAG, self.ctx, 'Invalid minimum cardinality {}.'.format(self.cardinality.minimum))
                return False
            if not CardinalitySettings._is_maximum_valid(self.cardinality.maximum):
                logger.error(self._TAG, self.ctx, 'Invalid maximum cardinality {}.'.format(self.cardinality.maximum))
                return False
        return True