Skip to content

Commit 1c6fb76

Browse files
authored
fix: validate the effective configuration (#2352)
Fixes an issue that we validate the original configuration coming from a request, but not the effective configuration that is created by merging the configuration profile with the request configuration. Tested with a custom version of field-service-routing in the sandbox environment.
1 parent a682654 commit 1c6fb76

2 files changed

Lines changed: 64 additions & 64 deletions

File tree

model/rest/src/main/java/ai/timefold/solver/model/rest/impl/AbstractModelAPIResource.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -656,12 +656,13 @@ public Multi<Metadata<Score_>> streamMetadata(
656656
@Produces(MediaType.APPLICATION_JSON)
657657
public ValidationResult<ValidationIssue_> getValidationResult(
658658
@Parameter(description = "Unique identifier of the schedule", required = true) @PathParam("id") String id) {
659-
ValidationBuilder validationBuilder = new ValidationBuilder();
660-
ModelRequest<ModelInput_, ModelConfigurationOverrides_> modelRequest = storageService.getModelRequest(id);
661-
if (modelRequest.modelInput() == null) {
659+
ModelInput_ modelInput = storageService.getModelInput(id);
660+
if (modelInput == null) {
662661
throw new ItemNotFoundException(ErrorCodes.STORAGE_NO_JOB_FOUND, id);
663662
}
664-
modelValidator.validate(validationBuilder, modelRequest.modelInput(), modelRequest.getModelConfig());
663+
var modelConfig = Configuration.getSafeModelConfig(storageService.getConfiguration(id));
664+
ValidationBuilder validationBuilder = new ValidationBuilder();
665+
modelValidator.validate(validationBuilder, modelInput, modelConfig);
665666
return validationBuilder.build();
666667
}
667668

0 commit comments

Comments
 (0)