Skip to content

Report field-level expected/actual values on schematron rule errors - #4

Merged
TheYoxy merged 1 commit into
masterfrom
feature/schematron-rule-error-fields
Sep 18, 2026
Merged

TheYoxy merged 1 commit into
masterfrom
feature/schematron-rule-error-fields

Conversation

@TheYoxy

@TheYoxy TheYoxy commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

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

  • Add SchematronFieldIssue and a required fields array to SchematronRuleError; broaden schematronRule to attach field details from a predicate that returns issues.
  • Report the compared field and every operand field in one rule error, aggregating all failing groups.
  • Populate details for CEN-EN16931 BR-CO-10..17, BR-{S,AF,AG,Z,E,G,O,IC,AE}-08/-09, and PEPPOL-EN16931 R040/R046/R120.
  • Align 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 errors
  • pnpm build -> completes
  • fallow --changed-since HEAD --type-aware --fail-on-issues -> exit 0
  • End-to-end tests in src/schematron/schematron.spec.ts assert the aggregate plus operand fields for BR-S-08 and BR-CO-10, and that non-calculation rules default fields to [].

…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.
@TheYoxy
TheYoxy merged commit 811d0a1 into master Sep 18, 2026
5 checks passed
@TheYoxy
TheYoxy deleted the feature/schematron-rule-error-fields branch September 18, 2026 23:21
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 0.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant