Swagger::ResponseObject Class Reference

Describes a single response from an API Operation. More...

Inheritance diagram for Swagger::ResponseObject:
[legend]

## Static Public Member Functions

static ResponseObject | newResponse (string key, hash< auto > oh, SwaggerSchema swagger)
| returns a new ResponseObject corresponding to the schema definition passed More...

## Public Attributes

string | desc
| Required. A short description of the response. GFM syntax can be used for rich text representation.
hash | examples
| A hash of example response messages. More...
hash< auto > | headers
| A hash of headers that are (can be) sent with the response. More...
*SchemaObject | schema
| A definition of the response structure. More...
Public Attributes inherited from Swagger::ObjectBase
hash< auto > | vendorExtensions
| Allows extensions to the Swagger Schema. More...

## Protected Member Functions

| constructor (string key, hash< auto > oh, SwaggerSchema swagger)
| private constructor; use newResponse() instead More...

## Additional Inherited Members

Public Member Functions inherited from Swagger::ObjectBase
| constructor ()
| Constructor.
| constructor (hash< auto > oh)
| Constructor. More...
| constructor (ObjectBase other)
| copy constructor
| initialize (hash< auto > oh)
| Initialize. More...

## Detailed Description

Describes a single response from an API Operation.

## Member Function Documentation

## constructor()

Swagger::ResponseObject::constructor | ( | string | key,
|  | hash< auto > | oh,
|  | SwaggerSchema | swagger
| ) |  |

protected

private constructor; use newResponse() instead

Parameters

  key | the response code for error reporting
  oh | deserialized hash from the source schema description describing a single response for an API operation
  swagger | the REST schema for resolving references

Exceptions

  INVALID-FIELD-TYPE | field has invalid type
  REQUIRED-FIELD-MISSING | required field is missing

## newResponse()

static ResponseObject Swagger::ResponseObject::newResponse | ( | string | key,
|  | hash< auto > | oh,
|  | SwaggerSchema | swagger
| ) |  |

static

returns a new ResponseObject corresponding to the schema definition passed

Parameters

  key | the response code for the response
  oh | deserialized hash from the source schema description describing a single response for an API operation
  swagger | the REST schema for resolving references

Exceptions

  INVALID-FIELD-TYPE | field has invalid type
  REQUIRED-FIELD-MISSING | required field is missing

## Member Data Documentation

## examples

hash Swagger::ResponseObject::examples

A hash of example response messages.

A hash of example responses in the form of `Example Object`. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#exampleObject Keys MUST be one of the Operation produces values (either implicit or inherited). The value SHOULD be an example of what such a response would look like.

## headers

hash<auto> Swagger::ResponseObject::headers

A hash of headers that are (can be) sent with the response.

A hash of HeaderObject objects. Keys are header names.

## schema

*SchemaObject Swagger::ResponseObject::schema

A definition of the response structure.

It can be a primitive, an array or an object. If this field does not exist, it means no content is returned as part of the response. As an extension to the SchemaObject, its root `type` value may also be `"file"`. This SHOULD be accompanied by a relevant `produces` mime-type.