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

Improve codegen validation errors #609

Open
tetron opened this issue Oct 12, 2022 · 0 comments
Open

Improve codegen validation errors #609

tetron opened this issue Oct 12, 2022 · 0 comments

Comments

@tetron
Copy link
Member

tetron commented Oct 12, 2022

Schema salad uses the ruamel.yaml "round trip" YAML parser.

This parser preserves comments and line numbers by using ruamel.yaml.comments.CommentedMap ruamel.yaml.comments.CommentedSeq. These objects behave like Python maps/sequences, but have an additional field lc (which stands for "line column" I think), the lc contains information for both where the Map or Seq element started, as well as where each of its contained items start as well. In addition, we set our own filename field to track what file an object came from.

The purpose of Schema salad is to validate documents based against a schema. The primary user is CWL but the schema salad is intended to be general purpose.

The line/column information is used to give better validation errors, so it is possible to communicate what part of the file had an invalid value.

The existing validator can be found in validate.validate. It uses SourceLine to format errors with line/column/filename information and raises ValidationException when something is wrong. SourceLine handles all the error formatting, particularly for nested errors.

The goal of this project is to bring the parser produced by code generator up to speed with the quality of errors produced by the default interpreted validator. This means identifying the various error cases which are the same in the interpreted validator and the code generated validator and improving the code generated validator's error reporting. I recommend developing a test suite of malformed documents to see how errors are reported in various cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants