schema-enforcer icon indicating copy to clipboard operation
schema-enforcer copied to clipboard

Print ID of schema in schema-enforcer validate output

Open PhillSimonds opened this issue 4 years ago • 0 comments

Environment

  • Python version: 3.7.9
  • schema-enforcer version: 1.0.1

Proposed Functionality

Right now, when two schemas are used to evaluate the same schema file, all checks pass, and the schema-enforcer validate --show-pass command is run -- it outputs the same pass message for both schemas. Neither of these messages indicates which schema is passing.

Use Case

Here is an example of the validate command run when two schemas are used to validate the data in the ./data/data.yml file

# jsonschema: schemas/dns_servers,schemas/syslog_servers
---
dns_servers:
  - address: "10.1.1.1"
  - address: "10.2.2.2"
syslog_servers:
  - address: "10.3.3.3"
chema-enforcer validate --show-pass
PASS | [FILE] ./data/data.yml
PASS | [FILE] ./data/data.yml
ALL SCHEMA VALIDATION CHECKS PASSED

It would be nice if the output were such that it showed which schema is validating the data when the pass message is generated.

chema-enforcer validate --show-pass
PASS | [FILE] ./data/data.yml [SCHEMA] schemas/dns_servers
PASS | [FILE] ./data/data.yml [SCHEMA] schemas/syslog_servers
ALL SCHEMA VALIDATION CHECKS PASSED

It would also be nice if the fail messages printed the schema location as well. Here is the current output of the fail message

PASS | [FILE] ./data/data.yml
FAIL | [ERROR] True is not of type 'string' [FILE] ./data/data.yml [PROPERTY] dns_servers:0:address

Here is the proposed output:

PASS | [FILE] ./data/data.yml [SCHEMA] schemas/syslog_servers
FAIL | [ERROR] True is not of type 'string' [FILE] ./data/data.yml [PROPERTY] dns_servers:0:address [SCHEMA] schemas/dns_servers

PhillSimonds avatar Feb 11 '21 19:02 PhillSimonds