XiaoFeiASK opened a new issue, #3608:
URL: https://github.com/apache/dubbo-go/issues/3608

   ## 问题描述
   protoc-gen-triple-openapi 生成 OpenAPI 文档时存在两个问题:
   - protobuf enum 字段会生成 $ref,但没有生成被引用的 enum component,导致引用目标不存在。
   - protobuf map 字段仅生成 type: object,未保留 map value 类型。
   例如,map<string, string> 未限制 value 为 string。
   
   
   该工具由 PR #2951 引入,问题由 #3598 任务 25 / PR #3606 新增测试覆盖后暴露。
   
   ## 影响
   
   - enum 字段引用不存在的 component,生成的 OpenAPI 文档不完整。
   - OpenAPI validator、Swagger UI 和客户端生成器可能无法正确解析 enum 字段。
   - map value 类型丢失,生成的 OpenAPI schema 与 protobuf 定义不一致。
   
   ## 预期
   - 为 enum 生成对应的 components.schemas 定义。
   - 为 map 通过 additionalProperties 生成 value schema。
   
   ## 建议修复方案
   
   - 在 `schema/schema.go` 中收集 enum descriptor,并生成对应的 `components.schemas`。
   - 在 `schema/util.go` 中读取 map 的 `FieldDescriptor.MapValue()`,将 value schema 
写入 `additionalProperties`。
   - 补充或更新 YAML、JSON golden test,验证修复后的 enum 和 map 输出。
   
   ## 参考
   - tools/protoc-gen-triple-openapi/internal/converter/schema/schema.go
   - tools/protoc-gen-triple-openapi/internal/converter/schema/util.go
   - PR #2951
   - PR #3606 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to