From 7a53feee22c873c4e35c86b3fc1d4647314b62bf Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Tue, 28 Jun 2016 15:53:20 +0530 Subject: [PATCH] marvin: fix codegeneration against API discovery endpoint This makes the commands.xml based codegeneration equivalent to the API discovery end point based discovery. This fixes the fields that the (api discovery based) codegenerator should produce in the generated python classes (cmd and response classes per api/module). The issue was that the autogenerated cloudstackAPI differed between api-based and apidocs-based code generation. With this fix the generated classes match exactly thereby allowing us to go with either methods to generate cloudstackAPI. Signed-off-by: Rohit Yadav --- tools/marvin/marvin/codegenerator.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/marvin/marvin/codegenerator.py b/tools/marvin/marvin/codegenerator.py index ba2a3255d1b..14f6d1380ae 100644 --- a/tools/marvin/marvin/codegenerator.py +++ b/tools/marvin/marvin/codegenerator.py @@ -368,6 +368,7 @@ class CodeGenerator(object): self.constructResponseFromJSON(innerResponse) paramProperty.subProperties.append(subProperty) paramProperty.type = response['type'] + paramProperty.dataType = response['type'] return paramProperty def loadCmdFromJSON(self, apiStream): @@ -404,13 +405,14 @@ class CodeGenerator(object): assert paramProperty.name if 'required' in param: - paramProperty.required = param['required'] + paramProperty.required = str(param['required']).lower() if 'description' in param: paramProperty.desc = param['description'] if 'type' in param: paramProperty.type = param['type'] + paramProperty.dataType = param['type'] csCmd.request.append(paramProperty)