Skip to content

Commit

Permalink
docs: Add register_check to the API reference
Browse files Browse the repository at this point in the history
  • Loading branch information
Stranger6667 committed Jan 13, 2021
1 parent 0fbf8e1 commit 8459dd9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions docs/api.rst
@@ -1,6 +1,11 @@
Public API reference
====================

Checks
~~~~~~

.. autofunction:: schemathesis.register_check

Fixups
~~~~~~

Expand Down Expand Up @@ -101,3 +106,4 @@ Open API-specific API
:noindex:

.. automethod:: add_link
:noindex:
12 changes: 11 additions & 1 deletion src/schemathesis/cli/__init__.py
Expand Up @@ -61,7 +61,17 @@ def register_target(function: Target) -> Target:


def register_check(function: CheckFunction) -> CheckFunction:
"""Register a new check for schemathesis CLI."""
"""Register a new check for schemathesis CLI.
:param function: A function to validate API responses.
.. code-block:: python
@schemathesis.register_check
def new_check(response, case):
# some awesome assertions!
...
"""
checks_module.ALL_CHECKS += (function,)
CHECKS_TYPE.choices += (function.__name__,) # type: ignore
return function
Expand Down

0 comments on commit 8459dd9

Please sign in to comment.