0

I'm trying to upgrade Swagger from 1.2 to 2.0 and I'm having issues getting the Operation type. In 1.2 the Operation Object included the Data Type Fields in order to describe the return value of the operation. But it doesn't look like this is the case for 2.0.

Is there a simple way to access an Operation Object's type?

4

1 回答 1

1

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."

So the type can be accessed from the response.schema.type or also response.schema.@ref

于 2015-04-16T19:29:40.387 回答