nastassiar
nastassiar

Reputation: 1621

Upgrading to swagger 2.0 getting Operation/DataType type

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?

Upvotes: 0

Views: 297

Answers (1)

nastassiar
nastassiar

Reputation: 1621

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

Upvotes: 1

Related Questions