Skip to content

Commit

Permalink
Prototype better oneOf validation messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Bjwebb committed Feb 5, 2019
1 parent 7bcec77 commit 42fb99f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions libcove/lib/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@ def oneOf_draft4(validator, oneOf, instance, schema):
if not errs:
first_valid = subschema
break
properties = subschema.get('properties', {})
if 'statementType' in instance and 'statementType' in properties:
print(properties['statementType'])
if [instance['statementType']] == properties['statementType'].get('enum', []):
for err in errs:
yield err
# FIXME
first_valid = None
break
# Need to handle:
# * Meaningful mesage when 'statementType' is missing, or does not match any enums
all_errors.extend(errs)
else:
yield ValidationError(
Expand Down

0 comments on commit 42fb99f

Please sign in to comment.