因此,我在使用Swagger(Core 1.5.7)使用XML对象定义时遇到了麻烦。这里是我的XML代码:Swagger将下划线转换为camelcase
这是我的阳明代码:
result:
type: object
description: Some random description
properties:
status:
type: string
xml:
attribute: true
another:
type: object
properties:
customer:
type: object
properties:
superId:
type: string
xml:
name: my_super_id
attribute: true
我可以得到status没有问题,但my_super_id是null因为扬鞭与在参数生成模型类CamelCase,即mySuperId而不是my_super_id。 在我生成的模型类,我有这个: public ResultAnotherCustomer(@JsonProperty("mySuperId") final String mySuperId)
有没有什么办法解决这个问题?
+0
当你说模型类是在你的服务器代码?谁明确抛出错误?它是XML解串器吗? –
+0
是的,Swagger在构建过程中生成的模型类。我在帖子中添加了其他信息,即生成的模型类中的CamelCase输出。 –
+0
也许我错过了一些东西 - 为什么你不能只是改变模型,所以它说@JsonProperty(“my_super_id”)? –