Module moonwalk.api.operation

API operation.

Extends the proto object.

Functions

constructor ([docstring], fn) Create an operation.
decode_docblock (name, api) Decode docblock for function.
prepare (connection) Finds an appropriate operation to handle a request.

Fields

use_markdown Use Markdown to format the "notes" section of the doc block.
summary_format Format string for the "summary" section of a doc block.
notes_format Format string for the "notes" section of a doc block.


Functions

constructor ([docstring], fn)
Create an operation. This function is not meant to be called directly (see proto.constructor ).

Parameters:

  • docstring string A string documenting the function, as described in the readme.
  • fn optional function A function to handle this operation.
decode_docblock (name, api)
Decode docblock for function.

Parameters:

  • name The name of the API operation function. This becomes the Swagger nickname.
  • api The api this operation belongs to.

Returns:

  1. The resource path (as defined by the @path tag).
  2. A table containing the API declaration .
  3. A table containing any referenced models.
prepare (connection)
Finds an appropriate operation to handle a request.

Extracts arguments from the request, and validates them based on the API author's validation rules. Modifies the request table with information about the extracted arguments if validation succeeds.

no operation was found.

Parameters:

Returns:

  1. A function to handle the operation, defined by the API author.
  2. A numeric table of arguments, with a length property to accomodate sparseness.
  3. A validator.failure instance if validation failed or

Fields

use_markdown
Use Markdown to format the "notes" section of the doc block.

Defaults to true.

summary_format
Format string for the "summary" section of a doc block.

Replacement tokens: {nickname}, {summary}, {notes}

notes_format
Format string for the "notes" section of a doc block.

Replacement tokens: {nickname}, {summary}, {notes}

generated by LDoc 1.4.0