Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ai.timefold.solver.service.definition.api.domain;

import java.util.Map;
import java.util.Set;

import jakarta.validation.constraints.Positive;
Expand All @@ -21,13 +22,21 @@
description = "Optional maximum number of threads to be used for solving.",
minimum = "1") @JsonInclude(JsonInclude.Include.NON_EMPTY) @Positive Integer maxThreadCount,
@JsonInclude(JsonInclude.Include.NON_NULL) @Schema(
description = "Optional tags to be assigned to the dataset.") @Size(max = 100) Set<String> tags) {
description = "Optional tags to be assigned to the dataset.") @Size(max = 100) Set<String> tags,
@JsonInclude(JsonInclude.Include.NON_NULL) @Schema(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add @Schema annotation that would hide it from OpenAPI spec. It should not really be advertised and by that none of the models api definitions would change.

description = "Optional additional options to be applied to the run.") Map<String, String> options) {

public RunConfiguration(String name, SolverTerminationConfig termination, Integer maxThreadCount, Set<String> tags) {
public RunConfiguration(String name, SolverTerminationConfig termination, Integer maxThreadCount, Set<String> tags,

Check warning on line 29 in service/definition/src/main/java/ai/timefold/solver/service/definition/api/domain/RunConfiguration.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this redundant constructor which is the same as a default one.

See more on https://sonarcloud.io/project/issues?id=ai.timefold%3Atimefold-solver&issues=AZ_57RCYkX3Ckn0GrFV8&open=AZ_57RCYkX3Ckn0GrFV8&pullRequest=2590
Map<String, String> options) {
this.name = name;
this.termination = termination;
this.tags = tags;
this.maxThreadCount = maxThreadCount;
this.options = options;
}

public RunConfiguration(String name, SolverTerminationConfig termination, Integer maxThreadCount, Set<String> tags) {
this(name, termination, maxThreadCount, tags, null);
}

public RunConfiguration(String name, SolverTerminationConfig termination) {
Expand All @@ -49,14 +58,15 @@
* @return a copy of this instance with given termination, never null
*/
public RunConfiguration withTermination(SolverTerminationConfig termination) {
return new RunConfiguration(name(), termination, maxThreadCount(), tags());
return new RunConfiguration(name(), termination, maxThreadCount(), tags(), options());
}

public RunConfiguration override(RunConfiguration configuration) {
String finalName = name;
SolverTerminationConfig finalTermination = termination;
Integer finalMaxThreadCount = maxThreadCount;
Set<String> finalTags = tags;
Map<String, String> finalOptions = options;

if (configuration == null) {
return this;
Expand All @@ -70,6 +80,10 @@
finalMaxThreadCount = configuration.maxThreadCount();
}

if (finalOptions == null) {
finalOptions = configuration.options();
}

if (finalTermination == null) {
finalTermination = configuration.termination();
} else {
Expand All @@ -80,6 +94,6 @@
finalTags = configuration.tags;
}

return new RunConfiguration(finalName, finalTermination, finalMaxThreadCount, finalTags);
return new RunConfiguration(finalName, finalTermination, finalMaxThreadCount, finalTags, finalOptions);
}
}
7 changes: 7 additions & 0 deletions service/test-model/src/build/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -2163,6 +2163,13 @@
"items" : {
"type" : "string"
}
},
"options" : {
"description" : "Optional additional options to be applied to the run.",
"type" : "object",
"additionalProperties" : {
"type" : "string"
}
}
},
"additionalProperties" : false
Expand Down
Loading