Loading...
Searching...
No Matches
Swagger Namespace Reference

main namespace for all public Swagger declarations More...

## Classes

class | ContactObject
| Contact information for the exposed API. More...
class | InfoObject
| The object provides metadata about the API. The metadata can be used by the clients if needed, and can be presented in the Swagger-UI for convenience. More...
class | LicenseObject
| License information for the exposed API. More...
class | ObjectBase
| Base class for the Swagger specification objects, wrapping the vendor extensions. More...
class | OperationObject
| Describes a single API operation on a path. More...
class | PathComponent
| Holds the relative paths to the individual endpoints. More...
class | PathItemObject
| Describes the operations available on a single path. More...
class | PathsObject
| This class stores the path tree for URI path matching. More...
class | SchemaBase
| Base used by OtherParameter, HeaderObject and SchemaObject. More...
class | SwaggerLoader
| Used for loading the Swagger definitions. More...
class | SwaggerSchema
| This is the root document object for the API specification. It combines what previously was the Resource Listing and API Declaration (version 1.2 and earlier) together into one document. More...

## Functions

private | checkMissingParams (hash< UriQueryInfo > h, *hash< auto > headers, auto body, hash< string, AbstractParameterObject > parameters, *hash< string, AbstractParameterObject > child_params)
| checks for missing params
private | doDefaultParams (reference< hash< UriQueryInfo > > h, reference< hash > headers, reference< auto > body, hash< string, AbstractParameterObject > parameters, *hash< string, AbstractParameterObject > child_params)
| add default parameters
| error (string err, string fmt)
| raises an exception with context information
hash< RestSchemaValidator::RestExampleRequestInfo > | getExampleRequest (string method, string path, PathItemObject pio, SwaggerSchema swagger, reference rbody)
| returns a hash of example message information for the given request
hash< RestExampleResponseInfo > | getExampleResponse (string method, string path, int code, reference< auto > body)
| returns a hash of example message information for the given request
hash< RestQoreExampleCodeInfo > | getQoreExampleRequest (string method, string path, PathItemObject pio, SwaggerSchema swagger)
| returns example Qore code for the given request
hash< RestQoreExampleCodeInfo > | getQoreExampleResponse (string method, string path, int code)
| returns example Qore code for the given response
*ResponseObject | getResponse (int code)
| returns the ResponseObject for hthe given HTTP code or NOTHING if none is configured
| parseRequest (PathItemObject pio, reference< hash< UriQueryInfo > > h, reference< auto > body, reference< hash > headers)
| parses and processes a REST request on the server side
| validateResponse (string method, string path, PathItemObject pio, int http_code, reference< auto > response_body, reference< hash< string, bool > > mime_types, bool deserialize=True)
| validates a response against the response definition, if any

## Variables

const | CollectionFormats = ...
| allowed collection formats
const | MimeContentTypes = keys MimeDataTypes
| MIME types for data serialization.
const | MimeDataTypes
| supported mime types for de/serializing data
const | ParameterCollectionFormats = ...
| valid parameter collection formats
const | SerializationModules = keys (map {$1.module: True}, MimeDataTypes.iterator(), $1.module)
| modules available for data serialization and/or deserialization
const | ValidIntFormats = ("int32", "int64")
| Valid integer type formats.
const | ValidIntFormatsHash = map {$1: True}
| A hash of valid integer type formats.
const | ValidNumberFormats = ("double", "float")
| Valid number type formats.
const | ValidNumberFormatsHash = map {$1: True}
| A hash of valid number type formats.
const | ValidSchemes = ("http", "https", "ws", "wss")
| Valid transfer protocol schemes.
const | ValidStringFormats = ("binary", "byte", "date", "date-time", "password")
| Valid string type formats.
const | ValidStringFormatsHash = map {$1: True}
| A hash of valid string type formats.
const | YamlSerialization
| Yaml serialization.

## Detailed Description

main namespace for all public Swagger declarations

## Function Documentation

## getExampleRequest()

hash< RestSchemaValidator::RestExampleRequestInfo > Swagger::getExampleRequest | ( | string | method,
|  | string | path,
|  | PathItemObject | pio,
|  | SwaggerSchema | swagger,
|  | reference | rbody
| ) |  |

returns a hash of example message information for the given request

Parameters

  method | the HTTP method (in lower case)
  path | the URI path of the request
  pio | the PathItemObject corresponding to the URI path
  swagger | the schema object itself
  rbody | the output example body value, if any

Returns
  a RestExampleRequestInfo hash of example message information for the given request

URI query arguments

get example message body

## getExampleResponse()

hash< RestExampleResponseInfo > Swagger::getExampleResponse | ( | string | method,
|  | string | path,
|  | int | code,
|  | reference< auto > | body
| ) |  |

returns a hash of example message information for the given request

Parameters

  method | the HTTP method of the original request (case insensitive)
  path | the URI path of the original request
  code | the HTTP response code of the response
  body | the output example body value, if any

Returns
  a RestExampleResponseInfo hash giving example response message info

## getQoreExampleRequest()

hash< RestQoreExampleCodeInfo > Swagger::getQoreExampleRequest | ( | string | method,
|  | string | path,
|  | PathItemObject | pio,
|  | SwaggerSchema | swagger
| ) |  |

returns example Qore code for the given request

Parameters

  method | the HTTP method (in lower case)
  path | the URI path of the request
  pio | the PathItemObject corresponding to the URI path
  swagger | the schema object itself

Returns
  a RestQoreExampleCodeInfo hash giving example Qore code to generate the given request message

## getQoreExampleResponse()

hash< RestQoreExampleCodeInfo > Swagger::getQoreExampleResponse | ( | string | method,
|  | string | path,
|  | int | code
| ) |  |

returns example Qore code for the given response

Parameters

  method | the HTTP method of the original request (case insensitive)
  path | the URI path of the original request
  code | the HTTP response code of the response

Returns
  a RestQoreExampleCodeInfo hash giving example Qore code to generate the given response message

## getResponse()

*ResponseObject Swagger::getResponse | ( | int | code | ) |

protected

returns the ResponseObject for hthe given HTTP code or NOTHING if none is configured

Returns
  the ResponseObject for hthe given HTTP code or NOTHING if none is configured

## parseRequest()

Swagger::parseRequest | ( | PathItemObject | pio,
|  | reference< hash< UriQueryInfo > > | h,
|  | reference< auto > | body,
|  | reference< hash > | headers
| ) |  |

parses and processes a REST request on the server side

Parameters

  pio | the PathItemObject corresponding to the URI path
  h | a reference to the URI query info hash
  body | a reference to the deserialized HTTP message body data
  headers | a reference to a hash of HTTP headers

Exceptions

  DESERIALIZATION-ERROR | invalid content-type
  INVALID-PARAMETER-NAME | invalid parameter name
  INVALID-PARAMETER-LOCATION | invalid parameter location
  MISSING-PARAMETER | missing parameter and parameter has no default value