mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-22 16:31:15 -05:00
15 lines
461 B
Python
15 lines
461 B
Python
import os
|
|
|
|
from flask import json
|
|
import jsonschema
|
|
|
|
def validate(json_string, schema_filename):
|
|
resolver = jsonschema.RefResolver('file://' + os.path.dirname(__file__) + '/', None)
|
|
with open(os.path.join(os.path.dirname(__file__), schema_filename)) as schema:
|
|
jsonschema.validate(
|
|
json.loads(json_string),
|
|
json.load(schema),
|
|
format_checker=jsonschema.FormatChecker(),
|
|
resolver=resolver
|
|
)
|