fix(backend_plugin): plugin common header and parameter default value (#181)
This commit is contained in:
@@ -20,9 +20,8 @@ import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/getkin/kin-openapi/openapi3"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/domain/plugin/entity"
|
||||
"github.com/getkin/kin-openapi/openapi3"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/crossdomain/plugin"
|
||||
common "github.com/coze-dev/coze-studio/backend/api/model/plugin_develop_common"
|
||||
@@ -33,14 +32,6 @@ import (
|
||||
func APIParamsToOpenapiOperation(reqParams, respParams []*common.APIParameter) (*openapi3.Operation, error) {
|
||||
op := &openapi3.Operation{}
|
||||
|
||||
if reqParams != nil && len(reqParams) == 0 {
|
||||
op.Parameters = []*openapi3.ParameterRef{}
|
||||
op.RequestBody = entity.DefaultOpenapi3RequestBody()
|
||||
}
|
||||
if respParams != nil && len(respParams) == 0 {
|
||||
op.Responses = entity.DefaultOpenapi3Responses()
|
||||
}
|
||||
|
||||
hasSetReqBody := false
|
||||
hasSetParams := false
|
||||
|
||||
@@ -136,6 +127,16 @@ 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 {
|
||||
op.Responses = entity.DefaultOpenapi3Responses()
|
||||
}
|
||||
|
||||
return op, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user