Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
schneidermic0 authored Sep 14, 2023
2 parents f652e6f + e154413 commit d41faa7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions json-validator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json
import jsonschema
from jsonschema import Draft7Validator
from jsonschema import validate
from jsonschema import exceptions
import os
import glob
Expand All @@ -25,11 +25,11 @@ def validate_json( schema, instance ):
json_schema = decode_json( schema )
json_instance = decode_json( instance )
try:
Draft7Validator(json_schema).validate(json_instance)
except jsonschema.exceptions.ValidationError as exVal:
msg_errors.append(f"::error file={instance},line=1,col=1::{exVal.message} in {instance}")
except jsonschema.exceptions.SchemaError as error_ex:
msg_errors.print(f"::error file={instance},line=1,col=1::{error_ex.message} in {instance}")
validate( instance=json_instance, schema=json_schema)
except jsonschema.exceptions.ValidationError as ex_validation:
msg_errors.append(f"::error file={instance},line=1,col=1::{ex_validation.message} in {instance}")
except jsonschema.exceptions.SchemaError as ex_schema:
msg_errors.print(f"::error file={instance},line=1,col=1::{ex_schema.message} in {instance}")
else:
#print(f"::set-output name={os.path.basename(instance).ljust(31)} valid instance of schema {os.path.basename(schema)}" )
print( "valid: " + os.path.basename(schema) + "; " + os.path.basename(instance))
Expand Down

0 comments on commit d41faa7

Please sign in to comment.