File tree Expand file tree Collapse file tree
main/java/com/coze/openapi/client/workflows/run
test/java/com/coze/openapi/service/service/workflow Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,4 +55,11 @@ public class RunWorkflowReq extends BaseReq {
5555 * */
5656 @ JsonProperty ("app_id" )
5757 private String appID ;
58+
59+ /*
60+ * The version number of the workflow is only valid when the running workflow belongs to the
61+ * resource library workflow. If no version number is specified, the latest version is used.
62+ * */
63+ @ JsonProperty ("workflow_version" )
64+ private String workflowVersion ;
5865}
Original file line number Diff line number Diff line change 2121import com .coze .openapi .client .workflows .run .model .WorkflowEvent ;
2222import com .coze .openapi .client .workflows .run .model .WorkflowEventType ;
2323import com .coze .openapi .utils .Utils ;
24+ import com .fasterxml .jackson .databind .JsonNode ;
25+ import com .fasterxml .jackson .databind .ObjectMapper ;
2426
2527import io .reactivex .subscribers .TestSubscriber ;
2628import okhttp3 .MediaType ;
3133
3234public class WorkFlowRunServiceTest {
3335
36+ private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper ();
37+
3438 private String eventData =
3539 "id: 0\n "
3640 + "event: Message\n "
@@ -157,6 +161,22 @@ void testCreate() throws Exception {
157161 assertEquals (50 , result .getUsage ().getOutputCount ());
158162 }
159163
164+ @ Test
165+ void testRunWorkflowReqSerializesWorkflowVersion () throws Exception {
166+ RunWorkflowReq req =
167+ RunWorkflowReq .builder ()
168+ .workflowID ("test_workflow_id" )
169+ .appID ("test_app_id" )
170+ .workflowVersion ("1.2.3" )
171+ .build ();
172+
173+ JsonNode json = OBJECT_MAPPER .readTree (OBJECT_MAPPER .writeValueAsString (req ));
174+
175+ assertEquals ("1.2.3" , json .get ("workflow_version" ).asText ());
176+ assertEquals ("test_workflow_id" , json .get ("workflow_id" ).asText ());
177+ assertEquals ("test_app_id" , json .get ("app_id" ).asText ());
178+ }
179+
160180 @ Test
161181 void testHistories () {
162182 // 验证 histories 方法
You can’t perform that action at this time.
0 commit comments