first
This commit is contained in:
23
igf_api/BaseEntity.py
Normal file
23
igf_api/BaseEntity.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import jsonschema
|
||||
|
||||
|
||||
class BaseEntity:
|
||||
|
||||
def __init__(self, connection):
|
||||
self.connection = connection
|
||||
|
||||
def validate_dict(self, dictionary, schema):
|
||||
# schema = {
|
||||
# 'type': 'object',
|
||||
# 'properties': {
|
||||
# 'key1': {'type': 'integer'},
|
||||
# 'key2': {'type': 'string'}
|
||||
# },
|
||||
# 'required': ['key1', 'key2']
|
||||
# }
|
||||
try:
|
||||
jsonschema.validate(dictionary, schema)
|
||||
return True
|
||||
except jsonschema.ValidationError as ex:
|
||||
print(ex)
|
||||
return False
|
Reference in New Issue
Block a user