feat: 请求schema data 增加 NIL 判断
This commit is contained in:
@@ -169,29 +169,31 @@ func (g *Generate) AddApiDoc(docFlag string, apiMeta define.UriConfig, request a
|
||||
apiOperate, isRead := g.initApiConfig(docFlag, apiMeta)
|
||||
//requestTypeStr := requestType.String()
|
||||
if isRead {
|
||||
for paramName, paramConfig := range schemaData.Value.Properties {
|
||||
apiOperate.Parameters = append(apiOperate.Parameters, &openapi3.ParameterRef{
|
||||
Extensions: nil,
|
||||
Origin: nil,
|
||||
Ref: "",
|
||||
Value: &openapi3.Parameter{
|
||||
Extensions: nil,
|
||||
Origin: nil,
|
||||
Name: paramName,
|
||||
In: strings.ToLower(consts.RequestDataLocationQuery.String()),
|
||||
Description: paramConfig.Value.Description,
|
||||
Style: "",
|
||||
Explode: nil,
|
||||
AllowEmptyValue: paramConfig.Value.AllowEmptyValue,
|
||||
AllowReserved: false,
|
||||
Deprecated: false,
|
||||
Required: op_array.ArrayType(paramConfig.Value.Required).Has(paramName) >= 0,
|
||||
Schema: paramConfig,
|
||||
Example: nil,
|
||||
Examples: nil,
|
||||
Content: nil,
|
||||
},
|
||||
})
|
||||
if nil != schemaData {
|
||||
for paramName, paramConfig := range schemaData.Value.Properties {
|
||||
apiOperate.Parameters = append(apiOperate.Parameters, &openapi3.ParameterRef{
|
||||
Extensions: nil,
|
||||
Origin: nil,
|
||||
Ref: "",
|
||||
Value: &openapi3.Parameter{
|
||||
Extensions: nil,
|
||||
Origin: nil,
|
||||
Name: paramName,
|
||||
In: strings.ToLower(consts.RequestDataLocationQuery.String()),
|
||||
Description: paramConfig.Value.Description,
|
||||
Style: "",
|
||||
Explode: nil,
|
||||
AllowEmptyValue: paramConfig.Value.AllowEmptyValue,
|
||||
AllowReserved: false,
|
||||
Deprecated: false,
|
||||
Required: op_array.ArrayType(paramConfig.Value.Required).Has(paramName) >= 0,
|
||||
Schema: paramConfig,
|
||||
Example: nil,
|
||||
Examples: nil,
|
||||
Content: nil,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
} else {
|
||||
apiOperate.RequestBody = &openapi3.RequestBodyRef{
|
||||
|
||||
Reference in New Issue
Block a user