fix(plugin): update tool may reset request or response parameters (#302)

This commit is contained in:
mrh997
2025-07-30 13:35:22 +08:00
committed by GitHub
parent e3930873c6
commit efa20f22f6
10 changed files with 69 additions and 71 deletions

View File

@@ -88,6 +88,15 @@ func APIParamsToOpenapiOperation(reqParams, respParams []*common.APIParameter) (
}
}
if reqParams != nil {
if !hasSetParams {
op.Parameters = []*openapi3.ParameterRef{}
}
if !hasSetReqBody {
op.RequestBody = entity.DefaultOpenapi3RequestBody()
}
}
hasSetRespBody := false
for _, apiParam := range respParams {
@@ -127,13 +136,7 @@ func APIParamsToOpenapiOperation(reqParams, respParams []*common.APIParameter) (
}
}
if op.Parameters == nil {
op.Parameters = []*openapi3.ParameterRef{}
}
if op.RequestBody == nil {
op.RequestBody = entity.DefaultOpenapi3RequestBody()
}
if op.Responses == nil {
if respParams != nil && !hasSetRespBody {
op.Responses = entity.DefaultOpenapi3Responses()
}

View File

@@ -822,7 +822,7 @@ func (p *PluginApplicationService) UpdateAPI(ctx context.Context, req *pluginAPI
method = &m
}
updateReq := &service.UpdateToolDraftRequest{
updateReq := &service.UpdateDraftToolRequest{
PluginID: req.PluginID,
ToolID: req.APIID,
Name: req.Name,