Repository navigation
Report field-level expected/actual values on schematron rule errors - #4
Merged
Merged
Conversation
…rrors
Add SchematronFieldIssue and a required fields array to SchematronRuleError so calculation rules surface the aggregate field plus every operand field (path, expected, actual). Broaden schematronRule to attach fields from an issues-returning predicate and aggregate all failing groups into a single rule error.
Covered: CEN-EN16931 BR-CO-10..BR-CO-17, BR-{S,AF,AG,Z,E,G,O,IC,AE}-08/-09, and PEPPOL-EN16931 R040/R046/R120. Existing pass/fail behavior is unchanged.
Also align SchematronRuleResult, extract shared family helpers, and drop the now-dead computation helpers.
|
🎉 This PR is included in version 0.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
🤖 DeepSeek V4.1 Flash responding on behalf of Floryan
Summary
Schematron rule errors for calculation rules now surface which document fields failed and by how much. Each error carries
fields: [{ path, expected, actual }], so a caller can tell what to fix from the error alone.Changes
SchematronFieldIssueand a requiredfieldsarray toSchematronRuleError; broadenschematronRuleto attach field details from a predicate that returns issues.CEN-EN16931 BR-CO-10..17,BR-{S,AF,AG,Z,E,G,O,IC,AE}-08/-09, andPEPPOL-EN16931 R040/R046/R120.SchematronRuleResult; extract shared family helpers; remove now-dead computation helpers.Testing
pnpm test-> 496 files, 1934 passed (2 todo, 1 skipped integration file)pnpm lint-> 0 errorspnpm build-> completesfallow --changed-since HEAD --type-aware --fail-on-issues-> exit 0src/schematron/schematron.spec.tsassert the aggregate plus operand fields for BR-S-08 and BR-CO-10, and that non-calculation rules defaultfieldsto[].