douyan2821 2019-02-16 14:23
浏览 250

Swagger生成的api客户端不再返回对象

I am using a swagger generated php-api client for eve online's esi api. I used to generate the client with codegen-cli-2.3.1. I generated the new client with codegen-cli-2.4.1. That creates problems, because the client functions not longer return objects but arrays.

With 2.3.1 i would get something like this:

object(Swagger\Client\Model\GetCharactersCharacterIdContracts200Ok)#45 (1) {
    ["container":protected]=>
    array(22) {
    ["assignee_id"]=>
    int(92016026)
    }
}

and to get the values I would do $result->getAssigneeId() because that's what swagger would generate.

with 2.4.1 i get this:

array(19) {
    ["assignee_id"]=>
    int(92016026)
}

where i can simply do $result["assignee_id"].

Now, minor versions are not supposed to break backwards compatibility, correct? Or is swagger as a concept not supposed to be updated? As in, when you you started with one codegen-cli version you simply stick with it to generate future api clients?

So do I only of the choice of staying with 2.3.1 or update to 2.4.1 and go through all my code to change the respective areas?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 运筹学排序问题中的在线排序
    • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
    • ¥30 求一段fortran代码用IVF编译运行的结果
    • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
    • ¥15 C++ 头文件/宏冲突问题解决
    • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
    • ¥50 安卓adb backup备份子用户应用数据失败
    • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
    • ¥30 python代码,帮调试,帮帮忙吧
    • ¥15 #MATLAB仿真#车辆换道路径规划