Add more CI checks for OpenAPI definitions and JSON Schemas (#1656)

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
This commit is contained in:
Kévin Commaille 2023-10-11 12:36:39 +02:00 committed by GitHub
parent c71b528148
commit 560d98ba9b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 315 additions and 34 deletions

View file

@ -1,5 +1,9 @@
#!/usr/bin/env python
#
# Validates the examples under `../data/event_schemas` against their JSON
# schemas. In the process, the JSON schemas are validated against the JSON
# Schema 2020-12 specification.
# Copyright 2016 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
@ -92,7 +96,8 @@ def check_example_file(examplepath, schemapath):
print ("Checking schema for: %r %r" % (examplepath, schemapath))
try:
jsonschema.validate(example, schema, resolver=resolver)
validator = jsonschema.Draft202012Validator(schema, resolver)
validator.validate(example)
except Exception as e:
raise ValueError("Error validating JSON schema for %r %r" % (
examplepath, schemapath