Skip to content

Commit

Permalink
Delayed registering module to just before constraint validation to en…
Browse files Browse the repository at this point in the history
…sure schemas are generated directly from the loaded module and not the compiled version. Fixes #259 (#263)
  • Loading branch information
david-waltermire authored Nov 25, 2024
1 parent aad8aa4 commit 7c6b05c
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ private IValidationResult validate(

IValidationResult validationResult = null;
try {
IModule module = bindingContext.registerModule(getModule(commandLine, bindingContext));
// get the module, but don't register it
IModule module = getModule(commandLine, bindingContext);
if (!commandLine.hasOption(NO_SCHEMA_VALIDATION_OPTION)) {
// perform schema validation
validationResult = getSchemaValidationProvider(module, commandLine, bindingContext)
Expand All @@ -263,6 +264,7 @@ private IValidationResult validate(
}

// perform constraint validation
bindingContext.registerModule(module); // ensure the module is registered
IValidationResult constraintValidationResult = bindingContext.validateWithConstraints(source, configuration);
validationResult = validationResult == null
? constraintValidationResult
Expand Down

0 comments on commit 7c6b05c

Please sign in to comment.