-
Notifications
You must be signed in to change notification settings - Fork 482
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
Template validator ? #362
Comments
I would say that an template validator is a welcome addition. I would also like to preventing to merging breaking templates. There could be a basic implementation.
Or an advanced configuration.
I've made setup some tests:
The simple version is very straight forward to implement. The advanced check with Yamale is propably the way to go. At first glance, yamale does not provide regex validation on the value field.
For complete validation we should catch the key @rmilecki What is your opinion on this? |
I'm all for it. My YAML experience comes from Linux kernel which uses YAML for defining syntax for Device Tree bingings. It's absolutely great for validation. FWIW Linux kernel uses I think we should definitely work on some more advanced validation. Trivial validation like checking for tabs / indentions isn't woth much in my opinion. That would be great to verify things like:
|
Regards to my earlier comment I'm debating if we should do this in a sepearete github actions. Currently all the checks mentioned in this issue are already implemented in the code of invoice2data. The validation of the template's syntax is tested in the according submodules. (line parser, regex, tables). When using it from the cli one can add the Detailed feedback
on it's way in this code: https://github.com/invoice-x/invoice2data/pull/471/files#diff-0b2a5a5cdf14a3c7ca6389c5b2901bd020bd83ff9ba401c19d18155b436c07d0R71-R72
grammar validation is not implemented. Not usefull for the keys, as we have no standard field names we endorse currently. Mistakes in for example group fields
Example with the invalid regex validation ( closing bracket missing):
When this happens, the logger reads:
The amount is by default a required field. This feedback will be in the logger:
After PR #491
Implemented in the static parser: invoice2data/src/invoice2data/extract/parsers/static.py Lines 13 to 14 in 0f50bc3
Implemented in: invoice2data/src/invoice2data/extract/invoice_template.py Lines 227 to 230 in 0f50bc3
will result in the logger as:
This is not implemented yet. An separate issue is in #485 Conclusion Let's close this issue after that pr is merged. |
Hello all,
i would like to run i2d with something like --check-template mytemplate.yml just for
That sort of tool can really help us making good yml files ... and "debug" yml files
The text was updated successfully, but these errors were encountered: