如何更改hotchocaly默认json序列化器
如何更改Hotchocalate使用的JSON序列化器,我在文档中找不到任何东西。
我试图查看源代码,但似乎在httprespessextensions中进行了硬编码。
它使用骆驼盒,因此将我的所有模型更改在应用程序的前侧会很痛苦, 有什么想法吗?我认为团队意识到这一点: https://github.com/chillicream/chillicream/chillicream/hotchocaly/hotchocaly/hhotchocaly/问题/4072 但是我正在寻找解决方法
How can i change the json serializer used by hotchocalate i could not find anything in the documentation.
i tried to look at the source code but it seems like it hard coded in the HttpResponseExtensions .
its uses camel case so it will a pain to change all my models in the front side of the app ,
any ideas ? i think that the team is aware of this : https://github.com/ChilliCream/hotchocolate/issues/4072 but i'm looking for a workaround
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在寻找将案例与模型匹配的方法时,会遇到这个问题。就我而言,我想在查询输入和响应字段中保持外壳相同。
通过添加命名约定来覆盖默认符号范围:
并将约定添加到GraphQl:
还值得注意的是,您可以更改数据中的顶级响应对象的名称:
a>
希望这对人们有帮助:)
Came across this question when looking for a way of matching cases to Models. In my case I wanted to keep casings the same for the query input and response fields.
Got around this by adding a naming convention to override the DefaultNamingConventions:
And adding the Convention to the GraphQL:
Also worth noting you can change the name of the top level response object in data:
Playground Before
Playground After
Hope this is helpful to folks :)
模式具有Camescase Field命名的大会。您会返回Pascalcass的响应,并在骆驼案中询问。在客户案例不敏感的情况下进行反序列化,并且不要触摸客户端模型。
Schema has convention of camescase field naming. It would be wierd you return PascalCasing in response, and asking in camel case. Make deserialization in client case insensitive, and don't touch client models.