|
|
@ -125,7 +125,7 @@ def resolve_references(path, schema):
|
|
|
|
if '$ref' in schema:
|
|
|
|
if '$ref' in schema:
|
|
|
|
value = schema['$ref']
|
|
|
|
value = schema['$ref']
|
|
|
|
path = os.path.join(os.path.dirname(path), value)
|
|
|
|
path = os.path.join(os.path.dirname(path), value)
|
|
|
|
with open(path) as f:
|
|
|
|
with open(path, encoding="utf-8") as f:
|
|
|
|
ref = yaml.load(f, OrderedLoader)
|
|
|
|
ref = yaml.load(f, OrderedLoader)
|
|
|
|
result = resolve_references(path, ref)
|
|
|
|
result = resolve_references(path, ref)
|
|
|
|
del schema['$ref']
|
|
|
|
del schema['$ref']
|
|
|
@ -664,11 +664,11 @@ class MatrixUnits(Units):
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
filepath = os.path.join(path, filename)
|
|
|
|
filepath = os.path.join(path, filename)
|
|
|
|
logger.info("Reading swagger API: %s" % filepath)
|
|
|
|
logger.info("Reading swagger API: %s" % filepath)
|
|
|
|
with open(filepath, "r") as f:
|
|
|
|
with open(filepath, "r", encoding="utf-8") as f:
|
|
|
|
# strip .yaml
|
|
|
|
# strip .yaml
|
|
|
|
group_name = filename[:-5].replace("-", "_")
|
|
|
|
group_name = filename[:-5].replace("-", "_")
|
|
|
|
group_name = "%s_%s" % (group_name, suffix)
|
|
|
|
group_name = "%s_%s" % (group_name, suffix)
|
|
|
|
api = yaml.load(f.read(), OrderedLoader)
|
|
|
|
api = yaml.load(f, OrderedLoader)
|
|
|
|
api = resolve_references(filepath, api)
|
|
|
|
api = resolve_references(filepath, api)
|
|
|
|
api["__meta"] = self._load_swagger_meta(
|
|
|
|
api["__meta"] = self._load_swagger_meta(
|
|
|
|
api, group_name
|
|
|
|
api, group_name
|
|
|
@ -698,11 +698,11 @@ class MatrixUnits(Units):
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
filepath = os.path.join(path, filename)
|
|
|
|
filepath = os.path.join(path, filename)
|
|
|
|
logger.info("Reading swagger definition: %s" % filepath)
|
|
|
|
logger.info("Reading swagger definition: %s" % filepath)
|
|
|
|
with open(filepath, "r") as f:
|
|
|
|
with open(filepath, "r", encoding="utf-8") as f:
|
|
|
|
# strip .yaml
|
|
|
|
# strip .yaml
|
|
|
|
group_name = re.sub(r"[^a-zA-Z0-9_]", "_", filename[:-5])
|
|
|
|
group_name = re.sub(r"[^a-zA-Z0-9_]", "_", filename[:-5])
|
|
|
|
group_name = "%s_%s" % (prefix, group_name)
|
|
|
|
group_name = "%s_%s" % (prefix, group_name)
|
|
|
|
definition = yaml.load(f.read(), OrderedLoader)
|
|
|
|
definition = yaml.load(f, OrderedLoader)
|
|
|
|
definition = resolve_references(filepath, definition)
|
|
|
|
definition = resolve_references(filepath, definition)
|
|
|
|
if 'type' not in definition:
|
|
|
|
if 'type' not in definition:
|
|
|
|
continue
|
|
|
|
continue
|
|
|
@ -741,7 +741,7 @@ class MatrixUnits(Units):
|
|
|
|
event_type = filename[:-5] # strip the ".yaml"
|
|
|
|
event_type = filename[:-5] # strip the ".yaml"
|
|
|
|
logger.info("Reading event schema: %s" % filepath)
|
|
|
|
logger.info("Reading event schema: %s" % filepath)
|
|
|
|
|
|
|
|
|
|
|
|
with open(filepath) as f:
|
|
|
|
with open(filepath, encoding="utf-8") as f:
|
|
|
|
event_schema = yaml.load(f, OrderedLoader)
|
|
|
|
event_schema = yaml.load(f, OrderedLoader)
|
|
|
|
|
|
|
|
|
|
|
|
schema_info = process_data_type(
|
|
|
|
schema_info = process_data_type(
|
|
|
@ -793,7 +793,7 @@ class MatrixUnits(Units):
|
|
|
|
filepath = os.path.join(path, filename)
|
|
|
|
filepath = os.path.join(path, filename)
|
|
|
|
logger.info("Reading event example: %s" % filepath)
|
|
|
|
logger.info("Reading event example: %s" % filepath)
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
with open(filepath, "r") as f:
|
|
|
|
with open(filepath, "r", encoding="utf-8") as f:
|
|
|
|
example = json.load(f)
|
|
|
|
example = json.load(f)
|
|
|
|
examples[filename] = examples.get(filename, [])
|
|
|
|
examples[filename] = examples.get(filename, [])
|
|
|
|
examples[filename].append(example)
|
|
|
|
examples[filename].append(example)
|
|
|
@ -831,7 +831,7 @@ class MatrixUnits(Units):
|
|
|
|
def read_event_schema(self, filepath):
|
|
|
|
def read_event_schema(self, filepath):
|
|
|
|
logger.info("Reading %s" % filepath)
|
|
|
|
logger.info("Reading %s" % filepath)
|
|
|
|
|
|
|
|
|
|
|
|
with open(filepath, "r") as f:
|
|
|
|
with open(filepath, "r", encoding="utf-8") as f:
|
|
|
|
json_schema = yaml.load(f, OrderedLoader)
|
|
|
|
json_schema = yaml.load(f, OrderedLoader)
|
|
|
|
|
|
|
|
|
|
|
|
schema = {
|
|
|
|
schema = {
|
|
|
@ -943,7 +943,7 @@ class MatrixUnits(Units):
|
|
|
|
|
|
|
|
|
|
|
|
title_part = None
|
|
|
|
title_part = None
|
|
|
|
changelog_lines = []
|
|
|
|
changelog_lines = []
|
|
|
|
with open(path, "r") as f:
|
|
|
|
with open(path, "r", encoding="utf-8") as f:
|
|
|
|
lines = f.readlines()
|
|
|
|
lines = f.readlines()
|
|
|
|
prev_line = None
|
|
|
|
prev_line = None
|
|
|
|
for line in (tc_lines + lines):
|
|
|
|
for line in (tc_lines + lines):
|
|
|
|