Skip to content
Closed
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
Expand Up @@ -55,4 +55,11 @@ public class RunWorkflowReq extends BaseReq {
* */
@JsonProperty("app_id")
private String appID;

/*
* The version number of the workflow is only valid when the running workflow belongs to the
* resource library workflow. If no version number is specified, the latest version is used.
* */
@JsonProperty("workflow_version")
private String workflowVersion;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import com.coze.openapi.client.workflows.run.model.WorkflowEvent;
import com.coze.openapi.client.workflows.run.model.WorkflowEventType;
import com.coze.openapi.utils.Utils;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

import io.reactivex.subscribers.TestSubscriber;
import okhttp3.MediaType;
Expand All @@ -31,6 +33,8 @@

public class WorkFlowRunServiceTest {

private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();

private String eventData =
"id: 0\n"
+ "event: Message\n"
Expand Down Expand Up @@ -157,6 +161,22 @@ void testCreate() throws Exception {
assertEquals(50, result.getUsage().getOutputCount());
}

@Test
void testRunWorkflowReqSerializesWorkflowVersion() throws Exception {
RunWorkflowReq req =
RunWorkflowReq.builder()
.workflowID("test_workflow_id")
.appID("test_app_id")
.workflowVersion("1.2.3")
.build();

JsonNode json = OBJECT_MAPPER.readTree(OBJECT_MAPPER.writeValueAsString(req));

assertEquals("1.2.3", json.get("workflow_version").asText());
assertEquals("test_workflow_id", json.get("workflow_id").asText());
assertEquals("test_app_id", json.get("app_id").asText());
}

@Test
void testHistories() {
// 验证 histories 方法
Expand Down
Loading