From 1d8588051a4e1a1e9f24653fd3edec4569aed153 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Tue, 6 Aug 2013 11:08:59 -0300 Subject: Add multiple schemas support for EIP. --- src/leap/services/eip/eipspec.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src/leap/services') diff --git a/src/leap/services/eip/eipspec.py b/src/leap/services/eip/eipspec.py index 94ba674f..9cc56be3 100644 --- a/src/leap/services/eip/eipspec.py +++ b/src/leap/services/eip/eipspec.py @@ -15,7 +15,15 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -eipservice_config_spec = { + +# Schemas dict +# To add a schema for a version you should follow the form: +# { '1': schema_v1, '2': schema_v2, ... etc } +# so for instance, to add the '2' version, you should do: +# eipservice_config_spec['2'] = schema_v2 +eipservice_config_spec = {} + +eipservice_config_spec['1'] = { 'description': 'sample eip service config', 'type': 'object', 'properties': { @@ -63,3 +71,15 @@ eipservice_config_spec = { } } } + + +def get_schema(version): + """ + Returns the schema corresponding to the version given. + + :param version: the version of the schema to get. + :type version: str + :rtype: dict or None if the version is not supported. + """ + schema = eipservice_config_spec.get(version, None) + return schema -- cgit v1.2.3