Skip to content

Conversation

@rousso
Copy link
Contributor

@rousso rousso commented Dec 25, 2025

This adds a transpiler to generate Schematron from EFX rules files.

Infrastructure:
- Add EfxRulesTranslator interface with translateRules methods
- Add factory methods to EfxTranslatorFactory
- Add convenience methods to EfxTranslator
- Update eforms-core dependency to 1.6.0-SNAPSHOT

Data Model:
- Create Schematron model classes (SchematronSchema, SchematronPattern,
  SchematronRule, SchematronAssert, SchematronLet, SchematronPhase,
  SchematronFile)
- Add Freemarker templates for Schematron XML generation
  (complete-validation.ftl, pattern.ftl, rule.ftl, assert.ftl, let.ftl)

Components:
- Create SchematronMarkupGenerator with Freemarker integration
- Create EfxRulesTranslatorV2 skeleton extending EfxExpressionTranslatorV2
- Add Freemarker 2.3.31 dependency to pom.xml

Status: Foundation complete, listener methods TODO
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a transpiler that generates Schematron validation files from EFX (eForms Expression) rules files. The PR adds extensive test resources covering the transpilation functionality.

Key Changes

  • Added comprehensive test fixtures for EFX rules translator
  • Implemented support for various EFX language features: variables, WHEN clauses, stages, notice types
  • Generated both static and dynamic Schematron output files
  • Added field definitions supporting test scenarios including fields with parentheses in IDs

Reviewed changes

Copilot reviewed 234 out of 234 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
fields-sdk2.json Added test field definition with parentheses in ID (BT-00(a)-Text)
testWithClause_VariablePositioning/* Test files for variable declaration positioning at pattern and rule levels
testWithClause_RootContextShortcut/* Test files for root context syntax (WITH /)
testWithClause_ContextVariable/* Test files for context variable syntax
testWhen_WithOtherwise/* Test files for WHEN/OTHERWISE conditional logic
testWhen_SimpleCondition/* Test files for simple WHEN conditions
testVariable_StageLevel/* Test files for stage-level variable scoping
testVariable_Global_AppearsBeforeIncludes/* Test files for global variable positioning
testStage_Multiple_GeneratesSeparatePatterns/* Test files for multiple stage handling
testOutput_FromSampleRulesFile/* Comprehensive sample rules test
testOutput_ComprehensiveMixedRules/* Test files for mixed ASSERT/REPORT rules
testInClause_SpecificNoticeTypes/* Test files for specific notice type filtering
testInClause_PhaseGeneration/* Test files for phase generation logic
testInClause_NoticeTypeRange/* Test files for notice type range expansion
testInClause_AllNoticeTypes/* Test files for wildcard notice types
testForClause_NodeReference/* Test files for node references in FOR clauses
testDiagnostics_SanitizesParentheses/* Test files for parentheses sanitization in diagnostics
testDiagnostics_NoDuplicateEntries/* Test files for duplicate diagnostic prevention
testDiagnostics_MultipleFields/* Test files for multiple field diagnostics
testAssertAndReport_Simple/* Basic ASSERT and REPORT test files

After thoroughly reviewing all the test resource files, I found no issues to report. The files are well-structured test fixtures that follow consistent patterns and demonstrate comprehensive coverage of the transpiler functionality. All XML is properly formatted, test scenarios are well-documented with comments, and the expected outputs are consistent with the input specifications.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

* Extends ExpressionPreprocessor to inherit common late-bound expression handling
* and adds Rules-specific variable declaration processing.
*/
class RulesPreprocessor extends ExpressionPreprocessor {
Copy link

Copilot AI Dec 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RulesPreprocessor should be made static, since the enclosing instance is not used.

Copilot uses AI. Check for mistakes.
boolean aNum = isNumeric(a);
boolean bNum = isNumeric(b);
if (aNum && bNum) {
return Integer.compare(Integer.parseInt(a), Integer.parseInt(b));
Copy link

Copilot AI Dec 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential uncaught 'java.lang.NumberFormatException'.

Copilot uses AI. Check for mistakes.
boolean aNum = isNumeric(a);
boolean bNum = isNumeric(b);
if (aNum && bNum) {
return Integer.compare(Integer.parseInt(a), Integer.parseInt(b));
Copy link

Copilot AI Dec 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential uncaught 'java.lang.NumberFormatException'.

Copilot uses AI. Check for mistakes.
…chematronMarkupGenerator to SchematronGenerator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants