Qore Swagger Module Reference 2.2.0
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::RestExampleRequestInfogetExampleRequest (string method, string path, PathItemObject pio, SwaggerSchema swagger, reference rbody)
 returns a hash of example message information for the given request More...
 
hash< RestExampleResponseInfo > getExampleResponse (string method, string path, int code, reference< auto > body)
 returns a hash of example message information for the given request More...
 
hash< RestQoreExampleCodeInfo > getQoreExampleRequest (string method, string path, PathItemObject pio, SwaggerSchema swagger)
 returns example Qore code for the given request More...
 
hash< RestQoreExampleCodeInfo > getQoreExampleResponse (string method, string path, int code)
 returns example Qore code for the given response More...
 
*ResponseObject getResponse (int code)
 returns the ResponseObject for hthe given HTTP code or NOTHING if none is configured More...
 
 parseRequest (PathItemObject pio, reference< hash< UriQueryInfo > > h, reference< auto > body, reference< hash > headers)
 parses and processes a REST request on the server side More...
 
 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 LM_ACCEPT_INVALID_BODY_PARAMS = (1 << 3)
 parse option: reconstruct invalid body parameters
 
const LM_ALL = ...
 parse options: all options
 
const LM_IGNORE_INVALID_REQUIRED = (1 << 2)
 parse option: ignore invalid "required" properties
 
const LM_IGNORE_MISSING_REQUIRED = (1 << 0)
 
const LM_LAX_COLLECTIONFORMAT = (1 << 1)
 parse option: allow collectionFormat on non-array types
 
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
methodthe HTTP method (in lower case)
paththe URI path of the request
piothe PathItemObject corresponding to the URI path
swaggerthe schema object itself
rbodythe 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
methodthe HTTP method of the original request (case insensitive)
paththe URI path of the original request
codethe HTTP response code of the response
bodythe 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
methodthe HTTP method (in lower case)
paththe URI path of the request
piothe PathItemObject corresponding to the URI path
swaggerthe 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
methodthe HTTP method of the original request (case insensitive)
paththe URI path of the original request
codethe 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)
private

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
piothe PathItemObject corresponding to the URI path
ha reference to the URI query info hash
bodya reference to the deserialized HTTP message body data
headersa reference to a hash of HTTP headers
Exceptions
DESERIALIZATION-ERRORinvalid content-type
INVALID-PARAMETER-NAMEinvalid parameter name
INVALID-PARAMETER-LOCATIONinvalid parameter location
MISSING-PARAMETERmissing parameter and parameter has no default value