Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

csharp 版本 bug:生成 json 时,嵌套的变量没有按 NameInMap 进行正确的转化 #169

Open
C-ld opened this issue Oct 15, 2024 · 0 comments

Comments

@C-ld
Copy link

C-ld commented Oct 15, 2024

背景:正在基于 openAPI 开发 RocketMQ Eventbridge SDK

场景:dara 生成 csharp 代码,request 类序列化生成 json

相关PR

darabonba 生成 csharp 版本时,会自动把 Request 类成员变量转成大驼峰命名,然后在生成 body 的 json 时通过 [NameInMap("")] 转成 dara 里的实际变量名。但实际使用中,发现这种转化只对 json 中的一级成员变量有效。

Request 接收端,即 EventBridge 在反序列化前的日志如下,请关注 requestBody 的 json 内容:

# csharp
2024-10-15 00:21:54.484@@@@@@@@[reactor-http-server-epoll-6]@@INFO@@accessLog[62]@@requestTraceId :  | url : http://127.0.0.1:7001/connection/createConnection | requestParam : {} | requestMethod : POST | requestBody : "{\"connectionName\":\"new-connection\",\"networkParameters\":{\"NetworkType\":\"PublicNetwork\",\"SecurityGroupId\":null,\"VpcId\":null,\"VswitcheId\":null}}"

可以看到,networkParameters 的成员变量都是大驼峰,类中的 NameInMap 未生效

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant