问题描述
在下面附上来自第三方托管的 API 端点之一的响应的片段。
"responses": {
"200": {
"description": "Returns an array of objects","schema": {
"type": "array","items": {
"type": "object","properties": {
"31": {
"type": "string","description": "Last Price"
},"55": {
"type": "string","description": "Symbol"
},... About 50 odd more fields ...
}
}
}
}
}
我正在使用 openapi-generator 生成客户端存根。生成的响应 POJO 中的字段如下所示:
@Serializedname("31")
private String _31;
@Serializedname("55")
private String _55;
....
@ApiModelProperty("Last Price")
public String get31() {
return this._31;
}
@ApiModelProperty("Symbol")
public String get55() {
return this._55;
}
是否可以通过某种方式修改 YAML,以便虽然 JSON 字段保持 31/55,但 POJO 字段名称从 _31/_55 更改为一些更传统的名称,例如 lastPrice/symbol。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)