def check_type_keywords(self, schema, rule, path):
        """
        All supported keywords:
         - allowempty_map
         - assertion
         - class
         - date
         - default
         - desc
         - enum
         - example
         - extensions
         - func
         - ident
         - include_name
         - map_regex_rule
         - mapping
         - matching
         - matching_rule
         - name
         - nullable
         - pattern
         - pattern_regexp
         - range
         - regex_mappings
         - required
         - schema
         - sequence
         - type
         - type_class
         - unique
         - version
        """
        if not self.strict_rule_validation:
            return

        global_keywords = ['type', 'desc', 'example', 'extensions', 'name', 'nullable', 'version', 'func', 'include']
        all_allowed_keywords = {
            'str': global_keywords + ['default', 'pattern', 'range', 'enum', 'required', 'unique', 'req'],
            'int': global_keywords + ['default', 'range', 'enum', 'required', 'unique'],
            'float': global_keywords + ['default', 'enum', 'range', 'required'],
            'number': global_keywords + ['default', 'enum'],
            'bool': global_keywords + ['default', 'enum'],
            'map': global_keywords + ['allowempty_map', 'mapping', 'map', 'allowempty', 'required', 'matching-rule', 'range', 'class'],
            'seq': global_keywords + ['sequence', 'seq', 'required', 'range', 'matching'],
            'sequence': global_keywords + ['sequence', 'seq', 'required'],
            'mapping': global_keywords + ['mapping', 'seq', 'required'],
            'timestamp': global_keywords + ['default', 'enum'],
            'date': global_keywords + ['default', 'enum'],
            'symbol': global_keywords + ['default', 'enum'],
            'scalar': global_keywords + ['default', 'enum'],
            'text': global_keywords + ['default', 'enum', 'pattern'],
            'any': global_keywords + ['default', 'enum'],
            'enum': global_keywords + ['default', 'enum'],
            'none': global_keywords + ['default', 'enum', 'required'],
        }
        rule_type = schema.get('type')
        if not rule_type:
            # Special cases for the "shortcut methods"
            if 'sequence' in schema or 'seq' in schema:
                rule_type = 'sequence'
            elif 'mapping' in schema or 'map' in schema:
                rule_type = 'mapping'

        allowed_keywords = all_allowed_keywords.get(rule_type)
        if not allowed_keywords and 'sequence' not in schema and 'mapping' not in schema and 'seq' not in schema and 'map' not in schema:
            raise RuleError('No allowed keywords found for type: {0}'.format(rule_type))

        for k, v in schema.items():
            if k not in allowed_keywords:
                raise RuleError('Keyword "{0}" is not supported for type: "{1}" '.format(k, rule_type))
def check_type_keywords ( self , schema , rule , path ) : if not self . strict_rule_validation : return global_keywords = [ 'type' , 'desc' , 'example' , 'extensions' , 'name' , 'nullable' , 'version' , 'func' , 'include' ] all_allowed_keywords = { 'str' : global_keywords + [ 'default' , 'pattern' , 'range' , 'enum' , 'required' , 'unique' , 'req' ] , 'int' : global_keywords + [ 'default' , 'range' , 'enum' , 'required' , 'unique' ] , 'float' : global_keywords + [ 'default' , 'enum' , 'range' , 'required' ] , 'number' : global_keywords + [ 'default' , 'enum' ] , 'bool' : global_keywords + [ 'default' , 'enum' ] , 'map' : global_keywords + [ 'allowempty_map' , 'mapping' , 'map' , 'allowempty' , 'required' , 'matching-rule' , 'range' , 'class' ] , 'seq' : global_keywords + [ 'sequence' , 'seq' , 'required' , 'range' , 'matching' ] , 'sequence' : global_keywords + [ 'sequence' , 'seq' , 'required' ] , 'mapping' : global_keywords + [ 'mapping' , 'seq' , 'required' ] , 'timestamp' : global_keywords + [ 'default' , 'enum' ] , 'date' : global_keywords + [ 'default' , 'enum' ] , 'symbol' : global_keywords + [ 'default' , 'enum' ] , 'scalar' : global_keywords + [ 'default' , 'enum' ] , 'text' : global_keywords + [ 'default' , 'enum' , 'pattern' ] , 'any' : global_keywords + [ 'default' , 'enum' ] , 'enum' : global_keywords + [ 'default' , 'enum' ] , 'none' : global_keywords + [ 'default' , 'enum' , 'required' ] , } rule_type = schema . get ( 'type' ) if not rule_type : if 'sequence' in schema or 'seq' in schema : rule_type = 'sequence' elif 'mapping' in schema or 'map' in schema : rule_type = 'mapping' allowed_keywords = all_allowed_keywords . get ( rule_type ) if not allowed_keywords and 'sequence' not in schema and 'mapping' not in schema and 'seq' not in schema and 'map' not in schema : raise RuleError ( 'No allowed keywords found for type: {0}' . format ( rule_type ) ) for k , v in schema . items ( ) : if k not in allowed_keywords : raise RuleError ( 'Keyword "{0}" is not supported for type: "{1}" ' . format ( k , rule_type ) )
All supported keywords:
         - allowempty_map
         - assertion
         - class
         - date
         - default
         - desc
         - enum
         - example
         - extensions
         - func
         - ident
         - include_name
         - map_regex_rule
         - mapping
         - matching
         - matching_rule
         - name
         - nullable
         - pattern
         - pattern_regexp
         - range
         - regex_mappings
         - required
         - schema
         - sequence
         - type
         - type_class
         - unique
         - version