mirror of
https://github.com/EDCD/EDDN.git
synced 2025-06-03 00:51:20 +03:00
Barf on unknown schemas (without a way to make them known, currently).
This commit is contained in:
parent
351b00aed2
commit
8badcc38e5
@ -3,11 +3,19 @@ from enum import IntEnum
|
||||
|
||||
class Validator(object):
|
||||
|
||||
schemas = {}
|
||||
|
||||
def validate(self, json_object):
|
||||
results = ValidationResults()
|
||||
|
||||
if "$schemaRef" not in json_object:
|
||||
results.add(ValidationSeverity.FATAL, JsonValidationException("No $schemaRef found, unable to validate."))
|
||||
return results
|
||||
|
||||
schemaRef = json_object["$schemaRef"]
|
||||
if schemaRef not in self.schemas.keys():
|
||||
# We don't want to go out to the Internet and retrieve unknown schemas.
|
||||
results.add(ValidationSeverity.FATAL, JsonValidationException("Schema " + schemaRef + " is unknown, unable to validate."))
|
||||
|
||||
return results
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user