Load swagger APIs as templating units. Check sections return strings.
This commit is contained in:
parent
99dfe64d5c
commit
1dc3d82664
3 changed files with 18 additions and 0 deletions
|
@ -26,6 +26,10 @@ class Sections(object):
|
||||||
continue
|
continue
|
||||||
section_key = func_name[len("render_"):]
|
section_key = func_name[len("render_"):]
|
||||||
section = func()
|
section = func()
|
||||||
|
if not isinstance(section, basestring):
|
||||||
|
raise Exception(
|
||||||
|
"Section function '%s' didn't return a string!" % func_name
|
||||||
|
)
|
||||||
section_dict[section_key] = section
|
section_dict[section_key] = section
|
||||||
self.log("Generated section '%s' : %s" % (
|
self.log("Generated section '%s' : %s" % (
|
||||||
section_key, section[:60].replace("\n","")
|
section_key, section[:60].replace("\n","")
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
from batesian import AccessKeyStore
|
from batesian import AccessKeyStore
|
||||||
from batesian.sections import Sections
|
from batesian.sections import Sections
|
||||||
import inspect
|
import inspect
|
||||||
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,23 @@ import inspect
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
|
||||||
class MatrixUnits(Units):
|
class MatrixUnits(Units):
|
||||||
|
|
||||||
|
def load_swagger_apis(self):
|
||||||
|
path = "../api/client-server/v1"
|
||||||
|
apis = {}
|
||||||
|
for filename in os.listdir(path):
|
||||||
|
if not filename.endswith(".yaml"):
|
||||||
|
continue
|
||||||
|
self.log("Reading swagger API: %s" % filename)
|
||||||
|
with open(os.path.join(path, filename), "r") as f:
|
||||||
|
# strip .yaml
|
||||||
|
apis[filename[:-5]] = yaml.load(f.read())
|
||||||
|
return apis
|
||||||
|
|
||||||
def load_common_event_fields(self):
|
def load_common_event_fields(self):
|
||||||
path = "../event-schemas/schema/v1/core"
|
path = "../event-schemas/schema/v1/core"
|
||||||
event_types = {}
|
event_types = {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue