Skip to content
Snippets Groups Projects
Commit 1036415a authored by Jiahang Chen's avatar Jiahang Chen
Browse files

fix dir json output

parent 10322492
No related branches found
No related tags found
1 merge request!4Dev chen
Pipeline #358523 passed
...@@ -513,9 +513,13 @@ def to_dir_json(self): ...@@ -513,9 +513,13 @@ def to_dir_json(self):
self.dir_json["attributes"]["thingStructure"]["links"].append(role_entry) self.dir_json["attributes"]["thingStructure"]["links"].append(role_entry)
for key in self.features.keys(): for key in self.features.keys():
feature_target = {
"class": self.features[key].to_json()["class"],
"identifier": self.features[key].to_json()["identifier"]
}
feature_entry = { feature_entry = {
"association": "features", "association": "features",
"target": self.features[key].to_json() "target": feature_target
} }
# if the feature has targets, like ml40::Composite # if the feature has targets, like ml40::Composite
if hasattr(self.features[key], 'targets'): if hasattr(self.features[key], 'targets'):
...@@ -576,9 +580,13 @@ def to_subthing_dir_json(self): ...@@ -576,9 +580,13 @@ def to_subthing_dir_json(self):
} }
json_out["links"].append(role_entry) json_out["links"].append(role_entry)
for key in self.features.keys(): for key in self.features.keys():
feature_target = {
"class": self.features[key].to_json()["class"],
"identifier": self.features[key].to_json()["identifier"]
}
feature_entry = { feature_entry = {
"association": "features", "association": "features",
"target": self.features[key].to_json() "target": feature_target
} }
json_out["links"].append(feature_entry) json_out["links"].append(feature_entry)
return json_out return json_out
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment