コード例 #1
0
 def before_swagger_generate(self):
     for o in self.options:
         if 'service' in o:
             self.service = o['service']
         if 'path' in o:
             self.path = o['path']
         if 'all' in o:
             self.all = o['all']
         if 'fields' in o:
             self.fields = o['fields']
         if 'refactor' in o:
             self.refactor = o['refactor']
         if 'headers' in o:
             self.headers = o['headers']
         if 'errors' in o:
             self.errors = o['errors']
     if not self.service:
         raise Exception("no service found")
     urls = self.halo.settings['mservices'][self.service]['record']['path']
     self.data = Util.analyze_swagger(urls)
     if "methods" in self.halo.settings['mservices'][
             self.service]['record']:
         self.methods = self.halo.settings['mservices'][
             self.service]['record']['methods']
         if "exclude" in self.halo.settings['mservices'][
                 self.service]['record']:
             self.exclude = self.halo.settings['mservices'][
                 self.service]['record']['exclude']
         else:
             self.exclude = False
     else:
         self.methods = []
コード例 #2
0
 def before_method_generate(self):
     self.id = None
     for o in self.options:
         if 'service' in o:
             self.service = o['service']
         if 'path' in o:
             self.path = o['path']
         if 'id' in o:
             self.id = o['id']
     if self.service not in self.halo.settings['mservices']:
         raise HaloPluginException("service not found in swagger : " +
                                   self.service)
     urls = self.halo.settings['mservices'][self.service]['urls']
     self.data = Util.analyze_swagger(urls)