File tree Expand file tree Collapse file tree 3 files changed +9
-13
lines changed Expand file tree Collapse file tree 3 files changed +9
-13
lines changed Original file line number Diff line number Diff line change 4040 is_int3
4141 is_float3
4242 is_float4x4
43- validate_data
4443
4544"""
4645from __future__ import absolute_import
4746
4847from .validators import is_int3
4948from .validators import is_float3
5049from .validators import is_float4x4
51- from .validators import validate_data
5250from .encoders import DataEncoder
5351from .encoders import DataDecoder
5452from .data import Data
6260 'is_int3' ,
6361 'is_float3' ,
6462 'is_float4x4' ,
65- 'validate_data' ,
6663 'json_load' ,
6764 'json_loads' ,
6865 'json_dump' ,
Original file line number Diff line number Diff line change @@ -221,7 +221,7 @@ def __setstate__(self, state):
221221 self .data = state ['data' ]
222222
223223 def validate_data (self ):
224- """Validate the data of this object against its data schema (`self.DATASCHEMA`).
224+ """Validate the object's data against its data schema (`self.DATASCHEMA`).
225225
226226 Returns
227227 -------
@@ -235,20 +235,19 @@ def validate_data(self):
235235 return self .DATASCHEMA .validate (self .data )
236236
237237 def validate_json (self ):
238- """Validate the data loaded from a JSON representation of the data of this object against its data schema (`self.DATASCHEMA `).
238+ """Validate the object's data against its json schema (`self.JSONSCHEMA `).
239239
240240 Returns
241241 -------
242- None
242+ str
243+ The validated JSON representation of the data.
243244
244245 Raises
245246 ------
246247 SchemaError
247248 """
248249 import jsonschema
249- jsondata = json .dumps (self .data , cls = DataEncoder )
250- data = json .loads (jsondata , cls = DataDecoder )
251- jsonschema .validate (data , schema = self .JSONSCHEMA )
252- self .data = data
253- self .DATASCHEMA .validate (self .data )
254- return jsondata
250+ jsonstring = json .dumps (self .data , cls = DataEncoder )
251+ jsondata = json .loads (jsonstring , cls = DataDecoder )
252+ jsonschema .validate (jsondata , schema = self .JSONSCHEMA )
253+ return jsonstring
Original file line number Diff line number Diff line change @@ -41,5 +41,5 @@ def validate_data(data, cls):
4141 SchemaError
4242 """
4343 import jsonschema
44- jsonschema .validate (data , schema = cls .get_JSONSCHEMA () )
44+ jsonschema .validate (data , schema = cls .JSONSCHEMA )
4545 return cls .DATASCHEMA .validate (data )
You can’t perform that action at this time.
0 commit comments