goatbar

pystac.Item validation failures

Oct 10th, 2020
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 7.36 KB | None | 0 0
  1. In [9]: item.validate()                                                                                                                
  2. ---------------------------------------------------------------------------
  3. ValidationError                           Traceback (most recent call last)
  4. ~/src/pystac-schwehr/pystac/validation/stac_validator.py in validate_core(self, stac_dict, stac_object_type, stac_version, href)
  5.     163         try:
  6. --> 164             self._validate_from_uri(stac_dict, schema_uri)
  7.     165             return schema_uri
  8.  
  9. ~/src/pystac-schwehr/pystac/validation/stac_validator.py in _validate_from_uri(self, stac_dict, schema_uri)
  10.     124         schema, resolver = self.get_schema_from_uri(schema_uri)
  11. --> 125         jsonschema.validate(instance=stac_dict, schema=schema, resolver=resolver)
  12.     126         for uri in resolver.store:
  13.  
  14. /usr/lib/python3/dist-packages/jsonschema/validators.py in validate(instance, schema, cls, *args, **kwargs)
  15.     933     if error is not None:
  16. --> 934         raise error
  17.     935
  18.  
  19. ValidationError: None is not of type 'object'
  20.  
  21. Failed validating 'type' in schema[0]:
  22.     {'properties': {'bbox': {'items': {'type': 'number'},
  23.                              'minItems': 4,
  24.                              'type': 'array'},
  25.                     'coordinates': {'items': {'type': 'number'},
  26.                                     'minItems': 2,
  27.                                     'type': 'array'},
  28.                     'type': {'enum': ['Point'], 'type': 'string'}},
  29.      'required': ['type', 'coordinates'],
  30.      'title': 'GeoJSON Point',
  31.      'type': 'object'}
  32.  
  33. On instance:
  34.     None
  35.  
  36. The above exception was the direct cause of the following exception:
  37.  
  38. STACValidationError                       Traceback (most recent call last)
  39. <ipython-input-9-ea5aa8dfeb4d> in <module>
  40. ----> 1 item.validate()
  41.  
  42. ~/src/pystac-schwehr/pystac/stac_object.py in validate(self)
  43.     239             STACValidationError
  44.     240         """
  45. --> 241         return pystac.validation.validate(self)
  46.    242
  47.    243     def get_root(self):
  48.  
  49. ~/src/pystac-schwehr/pystac/validation/__init__.py in validate(stac_object)
  50.     39         STACValidationError
  51.     40     """
  52. ---> 41     validate_dict(stac_dict=stac_object.to_dict(),
  53.      42                   stac_object_type=stac_object.STAC_OBJECT_TYPE,
  54.      43                   stac_version=pystac.get_stac_version(),
  55.  
  56. ~/src/pystac-schwehr/pystac/validation/__init__.py in validate_dict(stac_dict, stac_object_type, stac_version, extensions, href)
  57.      85         extensions = info.common_extensions
  58.      86
  59. ---> 87     return RegisteredValidator.get_validator().validate(stac_dict, stac_object_type, stac_version,
  60.      88                                                         extensions, href)
  61.      89
  62.  
  63. ~/src/pystac-schwehr/pystac/validation/stac_validator.py in validate(self, stac_dict, stac_object_type, stac_version, extensions, href)
  64.      68         """
  65.     69         results = []
  66. ---> 70         core_result = self.validate_core(stac_dict, stac_object_type, stac_version, href)
  67.     71         if core_result is not None:
  68.     72             results.append(core_result)
  69.  
  70. ~/src/pystac-schwehr/pystac/validation/stac_validator.py in validate_core(self, stac_dict, stac_object_type, stac_version, href)
  71.    167             msg = self._get_error_message(schema_uri, stac_object_type, None, href,
  72.    168                                           stac_dict.get('id'))
  73. --> 169             raise STACValidationError(msg, source=e) from e
  74.    170
  75.    171     def validate_extension(self, stac_dict, stac_object_type, stac_version, extension_id,
  76.  
  77. STACValidationError: Validation failed for ITEM with ID USGS/GAP/CONUS/2011 against schema at https://schemas.stacspec.org/v1.0.0-beta.2/item-spec/json-schema/item.json
  78.  
  79. In [10]: pystac.validation.validate(item)                                                                                              
  80. ---------------------------------------------------------------------------
  81. ValidationError                           Traceback (most recent call last)
  82. ~/src/pystac-schwehr/pystac/validation/stac_validator.py in validate_core(self, stac_dict, stac_object_type, stac_version, href)
  83.    163         try:
  84. --> 164             self._validate_from_uri(stac_dict, schema_uri)
  85.    165             return schema_uri
  86.  
  87. ~/src/pystac-schwehr/pystac/validation/stac_validator.py in _validate_from_uri(self, stac_dict, schema_uri)
  88.    124         schema, resolver = self.get_schema_from_uri(schema_uri)
  89. --> 125         jsonschema.validate(instance=stac_dict, schema=schema, resolver=resolver)
  90.    126         for uri in resolver.store:
  91.  
  92. /usr/lib/python3/dist-packages/jsonschema/validators.py in validate(instance, schema, cls, *args, **kwargs)
  93.    933     if error is not None:
  94. --> 934         raise error
  95.    935
  96.  
  97. ValidationError: None is not of type 'object'
  98.  
  99. Failed validating 'type' in schema[0]:
  100.    {'properties': {'bbox': {'items': {'type': 'number'},
  101.                             'minItems': 4,
  102.                             'type': 'array'},
  103.                    'coordinates': {'items': {'type': 'number'},
  104.                                    'minItems': 2,
  105.                                    'type': 'array'},
  106.                    'type': {'enum': ['Point'], 'type': 'string'}},
  107.     'required': ['type', 'coordinates'],
  108.     'title': 'GeoJSON Point',
  109.     'type': 'object'}
  110.  
  111. On instance:
  112.    None
  113.  
  114. The above exception was the direct cause of the following exception:
  115.  
  116. STACValidationError                       Traceback (most recent call last)
  117. <ipython-input-10-ada00c668668> in <module>
  118. ----> 1 pystac.validation.validate(item)
  119.  
  120. ~/src/pystac-schwehr/pystac/validation/__init__.py in validate(stac_object)
  121.     39         STACValidationError
  122.     40     """
  123. ---> 41     validate_dict(stac_dict=stac_object.to_dict(),
  124.      42                   stac_object_type=stac_object.STAC_OBJECT_TYPE,
  125.      43                   stac_version=pystac.get_stac_version(),
  126.  
  127. ~/src/pystac-schwehr/pystac/validation/__init__.py in validate_dict(stac_dict, stac_object_type, stac_version, extensions, href)
  128.      85         extensions = info.common_extensions
  129.      86
  130. ---> 87     return RegisteredValidator.get_validator().validate(stac_dict, stac_object_type, stac_version,
  131.      88                                                         extensions, href)
  132.      89
  133.  
  134. ~/src/pystac-schwehr/pystac/validation/stac_validator.py in validate(self, stac_dict, stac_object_type, stac_version, extensions, href)
  135.      68         """
  136.     69         results = []
  137. ---> 70         core_result = self.validate_core(stac_dict, stac_object_type, stac_version, href)
  138.     71         if core_result is not None:
  139.     72             results.append(core_result)
  140.  
  141. ~/src/pystac-schwehr/pystac/validation/stac_validator.py in validate_core(self, stac_dict, stac_object_type, stac_version, href)
  142.    167             msg = self._get_error_message(schema_uri, stac_object_type, None, href,
  143.    168                                           stac_dict.get('id'))
  144. --> 169             raise STACValidationError(msg, source=e) from e
  145.    170
  146.    171     def validate_extension(self, stac_dict, stac_object_type, stac_version, extension_id,
  147.  
  148. STACValidationError: Validation failed for ITEM with ID USGS/GAP/CONUS/2011 against schema at https://schemas.stacspec.org/v1.0.0-beta.2/item-spec/json-schema/item.json
  149.  
Add Comment
Please, Sign In to add comment