新增设备类型选项接口
Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Has been cancelled

This commit is contained in:
2026-09-22 12:35:26 +08:00
parent 22c3e7cc1a
commit 4330b8a40c
28 changed files with 671 additions and 8 deletions

View File

@@ -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