升级到 swagger 2.0 获得 Operation/DataType 类型

Upgrading to swagger 2.0 getting Operation/DataType type

我正在尝试将 Swagger 从 1.2 升级到 2.0,但在获取操作类型时遇到问题。在 1.2 中,操作对象包含数据类型字段以描述操作的 return 值。但看起来 2.0 的情况并非如此。

有没有简单的方法来访问操作对象的类型?

https://github.com/swagger-api/swagger-spec/wiki/Swagger-1.2-to-2.0-Migration-Guide

"The return value of an operation was moved to to the responses section, to be combined with the appropriate http status code (most likely in the 2XX range). As a result, the responses is now mandatory and must have at least one response described by it."

因此可以从 response.schema.type 或 response.schema.@ref

访问该类型