![]() |
Qore Swagger Module Reference 2.5
|
Describes a single API operation on a path. More...
#include <Swagger.qm.dox.h>
Public Member Methods | |
| void | checkMissingParams (soft< hash< string, AbstractSwaggerParameterObject > > child_params, hash< string, AbstractSwaggerParameterObject > parameters, auto body, hash< UriQueryInfo > h, soft< hash< auto > > headers) |
| checks for missing params | |
| void | constructor (SwaggerSchema swagger, hash< auto > oh, string path, string method) |
| Constructor. | |
| void | doDefaultParams (soft< hash< string, AbstractSwaggerParameterObject > > child_params, hash< string, AbstractSwaggerParameterObject > parameters, reference< auto > body, reference< hash< UriQueryInfo > > h, reference< hash > headers) |
| add default parameters | |
| void | error (string err, string fmt) |
| raises an exception with context information | |
| soft< RestSchemaValidator::AbstractParameterObject > | getBody () |
| Returns the body parameter, if any. | |
| hash< RestSchemaValidator::RestExampleRequestInfo > | getExampleRequest (reference rbody, SwaggerSchema swagger, PathItemObject pio, string method, string path) |
| get example message body | |
| hash< RestExampleResponseInfo > | getExampleResponse (reference< auto > body, int code, string method, string path) |
| returns a hash of example message information for the given request | |
| soft< hash< string, RestSchemaValidator::AbstractParameterObject > > | getParameters () |
| Returns a hash of parameters for this operation. | |
| hash< RestQoreExampleCodeInfo > | getQoreExampleRequest (SwaggerSchema swagger, PathItemObject pio, string method, string path) |
| returns example Qore code for the given request | |
| hash< RestQoreExampleCodeInfo > | getQoreExampleResponse (int code, string method, string path) |
| returns example Qore code for the given response | |
| soft< data > | getRequestBody (soft< bool > freeform, reference< hash< auto > > headers, RestSchemaValidator::AbstractPathItemObject abstract_pio, auto body) |
| Processes a generated request. | |
| soft< ResponseObject > | getResponse (int code) |
| returns the ResponseObject for hthe given HTTP code or NOTHING if none is configured | |
| RestSchemaValidator::AbstractResponsesObject | getResponses () |
| Returns the responses object for this operation. | |
| void | parseRequest (reference< hash > headers, reference< auto > body, PathItemObject pio, reference< hash< UriQueryInfo > > h) |
| parses and processes a REST request on the server side | |
| void | validateRequest (soft< bool > freeform, soft< reference< hash< string, bool > > > mime_types, reference< hash > headers, reference< auto > body, reference< hash< UriQueryInfo > > h, bool serialize, RestSchemaValidator::AbstractPathItemObject abstract_pio) |
| processes a REST API client-side request to the operation | |
| void | validateResponse (reference< hash< string, bool > > mime_types, bool deserialize, reference< auto > response_body, int http_code, PathItemObject pio, string method, string path) |
| validates a response against the response definition, if any | |
Public Member Methods inherited from Swagger::ParameterGroup | |
| void | addParameter (AbstractSwaggerParameterObject p) |
| Adds a parameter to the group. | |
| void | addParameter (string key, AbstractSwaggerParameterObject p) |
| Adds a parameter to the group. | |
| void | constructor (hash< auto > oh) |
| Creates the object from the hash definition. | |
Public Member Methods inherited from Swagger::ObjectBase | |
| void | constructor () |
| Constructor. | |
| void | constructor (hash< auto > oh) |
| Constructor. | |
| void | constructor (ObjectBase other) |
| Copy constructor. | |
Public Attributes | |
| AbstractSwaggerParameterObject | body |
| The body parameter, if defined. | |
| soft< ExternalDocumentationObject > | externalDocs |
| Additional external documentation for this operation. | |
| hash< string, AbstractSwaggerParameterObject > | formData |
| formData parameter; if defined for this operation, body parameter will be excluded | |
| soft< string > | operationId |
| Unique string used to identify the operation. | |
| ResponsesObject | responses |
| Required. The list of possible responses as they are returned from executing this operation. | |
| list< string > | schemes |
| The transfer protocol for the operation. | |
| list< hash< string, list< string > > > | security |
| A declaration of which security schemes are applied for this operation. | |
| list | tags |
| A list of tags (strings or TagObjects) for API documentation control. | |
Public Attributes inherited from Swagger::ParameterGroup | |
| string | query_obj |
| Any query param with type "object"? (OpenAPI 3 compatible) | |
Describes a single API operation on a path.
Inherits common operation members from AbstractOperationObject.
| void Swagger::OperationObject::constructor | ( | SwaggerSchema | swagger, |
| hash< auto > | oh, | ||
| string | path, | ||
| string | method | ||
| ) |
Constructor.
| path | the path for the operation |
| method | the HTTP method for the operation |
| oh | deserialized hash from the source schema description describing the operation |
| swagger | the REST schema for resolving references |
| INVALID-FIELD-TYPE | field has invalid type |
| INVALID-FIELD-VALUE | field has invalid value |
| REQUIRED-FIELD-MISSING | required field is missing |
| hash< RestExampleResponseInfo > Swagger::OperationObject::getExampleResponse | ( | reference< auto > | body, |
| int | code, | ||
| string | method, | ||
| string | path | ||
| ) |
returns a hash of example message information for the given request
| 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 |
| hash< RestQoreExampleCodeInfo > Swagger::OperationObject::getQoreExampleRequest | ( | SwaggerSchema | swagger, |
| PathItemObject | pio, | ||
| string | method, | ||
| string | path | ||
| ) |
returns example Qore code for the given request
| 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 |
| hash< RestQoreExampleCodeInfo > Swagger::OperationObject::getQoreExampleResponse | ( | int | code, |
| string | method, | ||
| string | path | ||
| ) |
returns example Qore code for the given response
| 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 |
| soft< ResponseObject > Swagger::OperationObject::getResponse | ( | int | code | ) |
returns the ResponseObject for hthe given HTTP code or NOTHING if none is configured
| void Swagger::OperationObject::parseRequest | ( | reference< hash > | headers, |
| reference< auto > | body, | ||
| PathItemObject | pio, | ||
| reference< hash< UriQueryInfo > > | h | ||
| ) |
parses and processes a REST request on the server side
| 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 |
| 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 |
| void Swagger::OperationObject::validateRequest | ( | soft< bool > | freeform, |
| soft< reference< hash< string, bool > > > | mime_types, | ||
| reference< hash > | headers, | ||
| reference< auto > | body, | ||
| reference< hash< UriQueryInfo > > | h, | ||
| bool | serialize, | ||
| RestSchemaValidator::AbstractPathItemObject | abstract_pio | ||
| ) |
processes a REST API client-side request to the operation
| serialize | if request arguments should be processed for serialization (client-side) or not (server-side) |
| abstract_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 |
| mime_types | a reference to a hash of valid mime types for the operation |
| freeform | do not validate types |
| SCHEMA-VALIDATION-ERROR | invalid parameter name or location, missing parameter and parameter has no default value |
| soft<string> Swagger::OperationObject::operationId |
Unique string used to identify the operation.
The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions.
| list<string> Swagger::OperationObject::schemes |
The transfer protocol for the operation.
Values MUST be from the list: "http", "https", "ws", "wss". The value overrides the SwaggerSchema schemes definition.
| list<hash<string, list<string> > > Swagger::OperationObject::security |
A declaration of which security schemes are applied for this operation.
The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). This definition overrides any declared top-level security. To remove a top-level security declaration, an empty array can be used.
Individual values are hashes in the form of Security Requirement Objects. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#securityRequirementObject. That is, the hash keys MUST correspond to security schemes declared in the Security Definitions, while the values are lists of scope names (strings) required for the execution.
| list Swagger::OperationObject::tags |
A list of tags (strings or TagObjects) for API documentation control.
Tags can be used for logical grouping of operations by resources or any other qualifier.