Merge "Updated action-plugin doc to refer to Voluptuous"

This commit is contained in:
Jenkins 2016-03-22 15:17:37 +00:00 committed by Gerrit Code Review
commit 64b5a7c3e4
1 changed files with 13 additions and 1 deletions

View File

@ -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
=====================