Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insufficient error information provided when yaml_resolver.py has a JSON schema error #370

Open
james-ball-qualcomm opened this issue Dec 20, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@james-ball-qualcomm
Copy link
Collaborator

Had a long debug session with Derek because JSON schema checker doesn't provide sufficient information on a failure. Need to find a better way to show the error information than using "best_match()".

Here's the current error message:

JSON Schema Validation Error for certificate_model/MC200-64.yaml:
'certificate_model/MC200-32.yaml#' is not of type 'array'

Here's the code:

write_yaml(resolved_path, resolved_obj)
if do_checks and ("$schema" in resolved_obj):
  schema = _get_schema(resolved_obj["$schema"])
  try:
    schema.validate(instance=resolved_obj)
  except ValidationError as e:
    print(f"JSON Schema Validation Error for {rel_path}:")
    **print(best_match(schema.iter_errors(resolved_obj)).message)**
    exit(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants