This commit is contained in:
@@ -84,3 +84,21 @@ const (
|
||||
// WeComSubmissionStatusUnknown 表示请求可能已到达企微但结果未知。
|
||||
WeComSubmissionStatusUnknown = 4
|
||||
)
|
||||
|
||||
// GetWeComSubmissionStatusName 返回企业微信提交状态中文名称。
|
||||
func GetWeComSubmissionStatusName(status int) string {
|
||||
switch status {
|
||||
case WeComSubmissionStatusReady:
|
||||
return "待提交"
|
||||
case WeComSubmissionStatusSending:
|
||||
return "发送中"
|
||||
case WeComSubmissionStatusSubmitted:
|
||||
return "已提交"
|
||||
case WeComSubmissionStatusFailed:
|
||||
return "提交失败"
|
||||
case WeComSubmissionStatusUnknown:
|
||||
return "结果未知"
|
||||
default:
|
||||
return "未知"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -378,9 +378,7 @@ func (g *Generator) setEnvelopeResponse(op *openapi3.Operation, output interface
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// 获取生成的 DTO schema
|
||||
dtoSchemaOrRef := tempOp.Responses.MapOfResponseOrRefValues[strconv.Itoa(statusCode)].Response.Content["application/json"].Schema
|
||||
|
||||
objectType := openapi3.SchemaType("object")
|
||||
integerType := openapi3.SchemaType("integer")
|
||||
stringType := openapi3.SchemaType("string")
|
||||
@@ -544,8 +542,15 @@ func (g *Generator) Save(filename string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if schemas := g.Reflector.Spec.Components; schemas != nil && schemas.Schemas != nil {
|
||||
if schema, ok := schemas.Schemas.MapOfSchemaOrRefValues["DtoDeviceTypeOptionsResponse"]; ok && schema.Schema != nil {
|
||||
nullable := false
|
||||
schema.Schema.Nullable = &nullable
|
||||
schemas.Schemas.MapOfSchemaOrRefValues["DtoDeviceTypeOptionsResponse"] = schema
|
||||
}
|
||||
}
|
||||
|
||||
// 安全的方法:MarshalJSON -> Unmarshal -> MarshalYAML
|
||||
// 这确保了我们遵守 openapi3 库中定义的 `json` 标签
|
||||
jsonBytes, err := g.Reflector.Spec.MarshalJSON()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user