validator icon indicating copy to clipboard operation
validator copied to clipboard

Bug fix for building scenario with schematron.

Open wustudent opened this issue 1 year ago • 1 comments

The code of v1.5.0 contains a bug which prevents building a scenario with schematron via the API:

In function Scenario.getSchematronValidations the function returns an empty list when there are no schematronValidations. But the return value Collections.emptyList() is an immutable list which can not perform add method. This getter will be called in ScenarioBuilder.buildSchematron with an add operation to add the build result, which leads to an UnsupportedOperationException

This pull request did the bug fix and add the test case for this case.

wustudent avatar Aug 20 '24 19:08 wustudent

The behavior that simply return an empty list is however still wrong, this is because: during the build stage of the scenario, when schematron is provided, schematron validation transformation should be added to the list of field schematronValidations. If we return an empty list but not assign it to the field, in the end all the schematrons will be ignored. Commit e5507b6 fixed this.

wustudent avatar Aug 21 '24 09:08 wustudent

This will be part of the upcoming 1.5.1 release - we included it manually 🤷🏼

phax avatar Aug 13 '25 16:08 phax