From 1e283d749b7a0c1edf5bd6b223344234728eb1fa Mon Sep 17 00:00:00 2001 From: "Xiaozheng(Rio) Liu" Date: Tue, 4 Aug 2026 13:23:10 +0800 Subject: [PATCH 1/2] fix(story): move productID from request body to query string ZenTao v2 API requires productID as a URL query parameter for story creation, but the SDK was sending it in the request body, causing 'Missing required parameter: productID' errors. Changes: - generated.ts: Move productID from requestBody schema to params array for the story/create action, so it's sent as a query parameter - resolve.ts: Add productID -> product fallback in buildQuery, matching the existing pageID -> page pattern for backward compatibility Fixes easysoft/zentao-cli#13 Fixes easysoft/zentao-cli#14 --- src/modules/generated.ts | 14 ++++++++------ src/modules/resolve.ts | 3 +++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/modules/generated.ts b/src/modules/generated.ts index 10572ef..53efe27 100644 --- a/src/modules/generated.ts +++ b/src/modules/generated.ts @@ -1266,17 +1266,20 @@ export const BUILTIN_MODULES = [ method: 'post', path: '/stories', resultType: 'object', + params: [ + { + name: 'productID', + required: true, + type: 'number', + description: '产品ID', + }, + ], requestBody: { required: true, type: 'object', schema: { "type": "object", "properties": { - "productID": { - "type": "integer", - "description": "产品ID", - "format": "int32" - }, "title": { "type": "string" }, @@ -1340,7 +1343,6 @@ export const BUILTIN_MODULES = [ } }, "required": [ - "productID", "title" ] }, diff --git a/src/modules/resolve.ts b/src/modules/resolve.ts index b17964e..d2d44fb 100644 --- a/src/modules/resolve.ts +++ b/src/modules/resolve.ts @@ -166,6 +166,9 @@ function buildQuery(action: ModuleAction, params: Record): Reco if (value === undefined && param.name === 'pageID') { value = params.page; } + if (value === undefined && param.name === 'productID') { + value = params.product; + } if (value === undefined) { value = param.defaultValue ?? param.options?.[0]?.value; } From 82e2add09c0010f95c7bd4690eb8a117bfddd231 Mon Sep 17 00:00:00 2001 From: "Xiaozheng(Rio) Liu" Date: Tue, 4 Aug 2026 14:00:05 +0800 Subject: [PATCH 2/2] fix: move productID to query params for bug, epic, requirement, productplan Apply the same fix as story/create to other modules that require productID as a query parameter: - bug/create: move productID from requestBody to params - epic/create: move productID from requestBody to params - requirement/create: move productID from requestBody to params - productplan/create: move productID from requestBody to params All these modules now work with the ZenTao v2 API. --- src/modules/generated.ts | 56 +++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/src/modules/generated.ts b/src/modules/generated.ts index 53efe27..8789f01 100644 --- a/src/modules/generated.ts +++ b/src/modules/generated.ts @@ -1081,17 +1081,20 @@ export const BUILTIN_MODULES = [ method: 'post', path: '/productplans', resultType: 'object', + params: [ + { + name: 'productID', + required: true, + type: 'number', + description: '产品ID', + }, + ], requestBody: { required: true, type: 'object', schema: { "type": "object", "properties": { - "productID": { - "type": "integer", - "description": "产品ID", - "format": "int32" - }, "title": { "type": "string", "description": "计划名称" @@ -1120,7 +1123,6 @@ export const BUILTIN_MODULES = [ } }, "required": [ - "productID", "title" ] }, @@ -1595,17 +1597,20 @@ export const BUILTIN_MODULES = [ method: 'post', path: '/epics', resultType: 'object', + params: [ + { + name: 'productID', + required: true, + type: 'number', + description: '产品ID', + }, + ], requestBody: { required: true, type: 'object', schema: { "type": "object", "properties": { - "productID": { - "type": "integer", - "description": "产品ID", - "format": "int32" - }, "title": { "type": "string" }, @@ -1659,7 +1664,6 @@ export const BUILTIN_MODULES = [ } }, "required": [ - "productID", "title" ] }, @@ -1913,17 +1917,20 @@ export const BUILTIN_MODULES = [ method: 'post', path: '/requirements', resultType: 'object', + params: [ + { + name: 'productID', + required: true, + type: 'number', + description: '产品ID', + }, + ], requestBody: { required: true, type: 'object', schema: { "type": "object", "properties": { - "productID": { - "type": "integer", - "description": "产品ID", - "format": "int32" - }, "title": { "type": "string" }, @@ -1977,7 +1984,6 @@ export const BUILTIN_MODULES = [ } }, "required": [ - "productID", "title" ] }, @@ -2221,17 +2227,20 @@ export const BUILTIN_MODULES = [ method: 'post', path: '/bugs', resultType: 'object', + params: [ + { + name: 'productID', + required: true, + type: 'number', + description: '所属产品', + }, + ], requestBody: { required: true, type: 'object', schema: { "type": "object", "properties": { - "productID": { - "type": "integer", - "description": "所属产品", - "format": "int32" - }, "title": { "type": "string", "description": "Bug标题" @@ -2278,7 +2287,6 @@ export const BUILTIN_MODULES = [ } }, "required": [ - "productID", "title", "openedBuild" ]