@staticmethod<EOL><INDENT>def parse(config):<DEDENT>
output = ComparatorValidator()<EOL>config = parsing.lowercase_keys(parsing.flatten_dictionaries(config))<EOL>output.config = config<EOL>output.extractor = _get_extractor(config)<EOL>if output.extractor is None:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>")<EOL><DEDENT>if '<STR_LIT>' not in config:  <EOL><INDENT>output.comparator_name = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>output.comparator_name = config['<STR_LIT>'].lower()<EOL><DEDENT>output.comparator = COMPARATORS[output.comparator_name]<EOL>if not output.comparator:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>try:<EOL><INDENT>expected = config['<STR_LIT>']<EOL><DEDENT>except KeyError:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>")<EOL><DEDENT>if isinstance(expected, basestring) or isinstance(expected, (int, long, float, complex)):<EOL><INDENT>output.expected = expected<EOL><DEDENT>elif isinstance(expected, dict):<EOL><INDENT>expected = parsing.lowercase_keys(expected)<EOL>template = expected.get('<STR_LIT>')<EOL>if template:  <EOL><INDENT>if not isinstance(template, basestring):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>")<EOL><DEDENT>output.isTemplateExpected = True<EOL>output.expected = template<EOL><DEDENT>else:  <EOL><INDENT>output.expected = _get_extractor(expected)<EOL>if not output.expected:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>")<EOL><DEDENT><DEDENT><DEDENT>return output<EOL>
Create a validator that does an extract from body and applies a comparator,
            Then does comparison vs expected value
            Syntax sample:
              { jsonpath_mini: 'node.child',
                operator: 'eq',
                expected: 'myValue'
              }