Skip to content

Commit

Permalink
Special case validation for 'Expression' (#243)
Browse files Browse the repository at this point in the history
Eliminate workaround of requiring both "string" and "Expression" even
when a string value wasn't meaningful.

refs #39
  • Loading branch information
tetron authored and mr-c committed Mar 26, 2019
1 parent 41a30b6 commit fade8a5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ COVBASE=coverage run --branch --append --source=${MODULE} \

# Updating the Major & Minor version below?
# Don't forget to update setup.py as well
VERSION=4.1.$(shell date +%Y%m%d%H%M%S --utc --date=`git log --first-parent \
VERSION=4.2.$(shell date +%Y%m%d%H%M%S --utc --date=`git log --first-parent \
--max-count=1 --format=format:%cI`)

## all : default task
Expand Down
7 changes: 7 additions & 0 deletions schema_salad/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,13 @@ def validate_ex(expected_schema, # type: Schema
u"value is a %s but expected a string" % (type(datum).__name__))
else:
return False
if expected_schema.name == "Expression":
if "$(" in datum or "${" in datum:
return True
if raise_ex:
raise ValidationException(u"value `%s` does not contain an expression in the form $() or ${}" % datum)
else:
return False
if datum in expected_schema.symbols:
return True
else:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
}

setup(name='schema-salad',
version='4.1', # update the VERSION prefix in the Makefile as well 🙂
version='4.2', # update the VERSION prefix in the Makefile as well 🙂
description='Schema Annotations for Linked Avro Data (SALAD)',
long_description=open(README).read(),
author='Common workflow language working group',
Expand Down

0 comments on commit fade8a5

Please sign in to comment.