Commit 9184432d authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[utils] Update dataformat_basetypes

The latest version of beat.core's dataformat schema has changed
the way basetype is defined. The code now supports both version.

Note that this simple parsing can be done due to the fact that
all the inforations are stored in the same schema file.
parent d2df3df6
......@@ -263,7 +263,23 @@ def dataformat_basetypes():
common_data = pkg_resources.resource_string("beat.core", "schema/common/1.json")
common_data = json.loads(common_data)
return common_data["definitions"]["basetype"]["enum"]
definitions = common_data["definitions"]
basetype = definitions["basetype"]
types = []
if "enum" in basetype:
types = basetype["enum"]
elif "anyOf" in basetype:
for item in basetype["anyOf"]:
if "$ref" in item:
definition = item["$ref"].split("/")[-1]
types += definitions[definition]["enum"]
elif "enum" in item:
types += item["enum"]
raise RuntimeError("Unsupported schema version")
return types
def is_Qt_equal_or_higher(version_string):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment