Updated action-plugin doc to refer to Voluptuous
In this patchset, I added a small subsection which highlights the fact that actions are using Voluptuous Schemas to validate their input parameters. Change-Id: I96a6060cf167468e4a3f7c8d8cd78330a20572e3 Closes-Bug: #1545643
This commit is contained in:
parent
2836f460e3
commit
446fe1307a
|
@ -50,6 +50,8 @@ Here is an example showing how you can write a plugin called ``DummyAction``:
|
|||
|
||||
# Filepath = <PROJECT_DIR>/thirdparty/dummy.py
|
||||
# Import path = thirdparty.dummy
|
||||
import voluptuous
|
||||
|
||||
from watcher.applier.actions import base
|
||||
|
||||
|
||||
|
@ -57,7 +59,7 @@ Here is an example showing how you can write a plugin called ``DummyAction``:
|
|||
|
||||
@property
|
||||
def schema(self):
|
||||
return Schema({})
|
||||
return voluptuous.Schema({})
|
||||
|
||||
def execute(self):
|
||||
# Does nothing
|
||||
|
@ -83,6 +85,16 @@ To get a better understanding on how to implement a more advanced action,
|
|||
have a look at the :py:class:`~watcher.applier.actions.migration.Migrate`
|
||||
class.
|
||||
|
||||
Input validation
|
||||
----------------
|
||||
|
||||
As you can see in the previous example, we are using `Voluptuous`_ to validate
|
||||
the input parameters of an action. So if you want to learn more about how to
|
||||
work with `Voluptuous`_, you can have a look at their `documentation`_ here:
|
||||
|
||||
.. _Voluptuous: https://github.com/alecthomas/voluptuous
|
||||
.. _documentation: https://github.com/alecthomas/voluptuous/blob/master/README.md
|
||||
|
||||
Abstract Plugin Class
|
||||
=====================
|
||||
|
||||
|
|
Loading…
Reference in New Issue