From 446fe1307afcd98f3304c95ae757dd833eead160 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Fran=C3=A7oise?= Date: Mon, 21 Mar 2016 11:33:31 +0100 Subject: [PATCH] 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 --- doc/source/dev/plugin/action-plugin.rst | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/source/dev/plugin/action-plugin.rst b/doc/source/dev/plugin/action-plugin.rst index c1816994c..6c6718552 100644 --- a/doc/source/dev/plugin/action-plugin.rst +++ b/doc/source/dev/plugin/action-plugin.rst @@ -50,6 +50,8 @@ Here is an example showing how you can write a plugin called ``DummyAction``: # Filepath = /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 =====================