Skip to content

Commit

Permalink
Merge pull request #381 from STARInformatics/issue-380-update-reasone…
Browse files Browse the repository at this point in the history
…r-validator

Update test_valid.py to use latest (>=3.1.4) reasoner-validator Python API
  • Loading branch information
edeutsch authored Nov 4, 2022
2 parents 91338a1 + d3385f4 commit f73e574
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/test_valid.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
"""OpenAPI 3.0 validation and examples validation."""
import json
from sys import stderr
import os
import pathlib
import jsonschema
import requests
import yaml
from jsonschema.exceptions import ValidationError
from reasoner_validator import validate
from reasoner_validator import TRAPISchemaValidator


def test_valid():
Expand Down Expand Up @@ -34,12 +35,13 @@ def test_examples():
print(full_path)
example = json.load(f)
trapi_version_locally = spec['info']['x-trapi']['version']
validator = TRAPISchemaValidator(trapi_version=trapi_version_locally)
try:
validate(
validator.validate(
instance=example,
component="Message",
trapi_version=trapi_version_locally
component="Message"
)
except ValidationError:
print(validator.to_dict(), file=stderr)
raise ValueError('TRAPI example is not valid against the trapi_version specified!')

0 comments on commit f73e574

Please sign in to comment.