-
Notifications
You must be signed in to change notification settings - Fork 2
Tedefo 4805 efx rules translator #129
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
base: develop
Are you sure you want to change the base?
Conversation
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
There was a problem hiding this 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 { |
Copilot
AI
Dec 25, 2025
There was a problem hiding this comment.
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.
| boolean aNum = isNumeric(a); | ||
| boolean bNum = isNumeric(b); | ||
| if (aNum && bNum) { | ||
| return Integer.compare(Integer.parseInt(a), Integer.parseInt(b)); |
Copilot
AI
Dec 25, 2025
There was a problem hiding this comment.
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'.
| boolean aNum = isNumeric(a); | ||
| boolean bNum = isNumeric(b); | ||
| if (aNum && bNum) { | ||
| return Integer.compare(Integer.parseInt(a), Integer.parseInt(b)); |
Copilot
AI
Dec 25, 2025
There was a problem hiding this comment.
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'.
…chematronMarkupGenerator to SchematronGenerator
This adds a transpiler to generate Schematron from EFX rules files.