diff options
author | shangxdy <shang.xiaodong@zte.com.cn> | 2016-08-15 15:43:07 +0800 |
---|---|---|
committer | shangxdy <shang.xiaodong@zte.com.cn> | 2016-08-15 15:43:07 +0800 |
commit | f52871b8f5ed66924ae8c715788d0bc09c1518ac (patch) | |
tree | 7661b3950879901ce4245ee67d5dc51dcfb7d524 /tosca2heat/tosca-parser/toscaparser/parameters.py | |
parent | 5559b0c06930deb1c7831efe599a1036574f50b3 (diff) |
Add required definition in class of Input.
As a template designer;
I want to know if the parameters is missed when deploy a template, but
currently there is not validation about the required parameters;
So i add property in class of Input, and validate the require parameter.
Note: the patch will submit to Openstack community too.
JIRA:PARSER-88
Change-Id: I5763a18da4037b0f81a55b8c8d83414e685b03d2
Signed-off-by: shangxdy <shang.xiaodong@zte.com.cn>
Diffstat (limited to 'tosca2heat/tosca-parser/toscaparser/parameters.py')
-rw-r--r-- | tosca2heat/tosca-parser/toscaparser/parameters.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tosca2heat/tosca-parser/toscaparser/parameters.py b/tosca2heat/tosca-parser/toscaparser/parameters.py index 1d2cb29..ca8e697 100644 --- a/tosca2heat/tosca-parser/toscaparser/parameters.py +++ b/tosca2heat/tosca-parser/toscaparser/parameters.py @@ -35,11 +35,18 @@ class Input(object): self.name = name self.schema = Schema(name, schema_dict) + self._validate_field() + self.validate_type(self.type) + @property def type(self): return self.schema.type @property + def required(self): + return self.schema.required + + @property def description(self): return self.schema.description @@ -52,8 +59,6 @@ class Input(object): return self.schema.constraints def validate(self, value=None): - self._validate_field() - self.validate_type(self.type) if value is not None: self._validate_value(value) |