Skip to content

Commit

Permalink
Accommodate absence of last execution
Browse files Browse the repository at this point in the history
A task's last execution is absent if it has not yet been executed.
This commit updates the documentation test to accommodate this
possibility.

See spring-projectsgh-42351
  • Loading branch information
wilkinsona committed Sep 19, 2024
1 parent 627c691 commit 6346d4f
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ void scheduledTasks() {
fieldWithPath("custom.[].trigger").description("Trigger for the task."))
.andWithPrefix("*.[].",
fieldWithPath("lastExecution").description("Last execution of this task, if any.")
.optional())
.optional()
.type(JsonFieldType.OBJECT))
.andWithPrefix("*.[].lastExecution.", lastExecution())));
}

Expand All @@ -98,7 +99,8 @@ private FieldDescriptor nextExecutionWithPrefix(String prefix) {

private FieldDescriptor[] lastExecution() {
return new FieldDescriptor[] {
fieldWithPath("status").description("Status of the last execution (STARTED, SUCCESS, ERROR)."),
fieldWithPath("status").description("Status of the last execution (STARTED, SUCCESS, ERROR).")
.type(JsonFieldType.STRING),
fieldWithPath("time").description("Time of the last execution.").type(JsonFieldType.STRING),
fieldWithPath("exception.type").description("Exception type thrown by the task, if any.")
.type(JsonFieldType.STRING)
Expand Down

0 comments on commit 6346d4f

Please sign in to comment.