Browse Source

Fix the schema validator to validate areas properly

Gu1 11 years ago
parent
commit
52fb459690
1 changed files with 5 additions and 1 deletions
  1. 5 1
      ispformat/validator/schemavalidator.py

+ 5 - 1
ispformat/validator/schemavalidator.py

@@ -78,8 +78,12 @@ def validate_isp(jdict):
                               validator=u'validate_url', validator_value=url)
 
     for i, ca in enumerate(jdict.get('coveredAreas', [])):
-        if validate_geojson(ca.get('area', {})):
+        area=ca.get('area')
+        if area and validate_geojson(area):
             continue
+        elif not area:
+            continue
+
         yield ValidationError(
             u'GeoJSON can only contain the following types: %s'%repr(geojson_allowed_types),
             instance=ca, schema=schema[u'definitions'][u'coveredArea'][u'properties'][u'area'],