Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
KWH40
fml40-reference-implementation
Commits
1036415a
Commit
1036415a
authored
Nov 10, 2020
by
Jiahang Chen
Browse files
fix dir json output
parent
10322492
Pipeline
#358523
passed with stage
in 14 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ml/thing.py
View file @
1036415a
...
...
@@ -513,9 +513,13 @@ def to_dir_json(self):
self
.
dir_json
[
"attributes"
][
"thingStructure"
][
"links"
].
append
(
role_entry
)
for
key
in
self
.
features
.
keys
():
feature_target
=
{
"class"
:
self
.
features
[
key
].
to_json
()[
"class"
],
"identifier"
:
self
.
features
[
key
].
to_json
()[
"identifier"
]
}
feature_entry
=
{
"association"
:
"features"
,
"target"
:
self
.
feature
s
[
key
].
to_json
()
"target"
:
feature
_target
}
# if the feature has targets, like ml40::Composite
if
hasattr
(
self
.
features
[
key
],
'targets'
):
...
...
@@ -576,9 +580,13 @@ def to_subthing_dir_json(self):
}
json_out
[
"links"
].
append
(
role_entry
)
for
key
in
self
.
features
.
keys
():
feature_target
=
{
"class"
:
self
.
features
[
key
].
to_json
()[
"class"
],
"identifier"
:
self
.
features
[
key
].
to_json
()[
"identifier"
]
}
feature_entry
=
{
"association"
:
"features"
,
"target"
:
self
.
feature
s
[
key
].
to_json
()
"target"
:
feature
_target
}
json_out
[
"links"
].
append
(
feature_entry
)
return
json_out
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment