JadConfig icon indicating copy to clipboard operation
JadConfig copied to clipboard

Collect all validation errors and then fail

Open todvora opened this issue 1 year ago • 2 comments

Current implementation stops with the first validation/parameter exception. If users have several problems in the configuration, they need to fix one by one and always restart the graylog server meanwhile. If we could collect all errors and only then fail, it would simplify initial setups significantly.

Maybe it would be enough to adapt https://github.com/Graylog2/JadConfig/blob/main/src/main/java/com/github/joschi/jadconfig/JadConfig.java#L91 , instead of throwing exceptions collect them and then fail if there is at least one, throwing one wrapping all failures.

todvora avatar Mar 06 '24 09:03 todvora

@todvora We could introduce an additional parse method that behaves like that. Changing the behavior of the existing #process method would be a breaking change.

bernd avatar Mar 06 '24 11:03 bernd

Implemented in https://github.com/Graylog2/JadConfig/pull/127. Here it would need only a very tiny change, switching from jadConfig.process() to jadConfig.processFailingLazily()

todvora avatar Apr 25 '24 15:04 todvora