You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
The FIWARE service paths endpoint returns alot of extra fields besides the actual paths. In particular, for each path p there's a children field that contains the whole service path tree starting from the last node of p. Perhaps this is more than clients actually need. (Also, the root path will already contain the whole tree anyway.) We could return just root-to-leaf paths without including children fields.
Note. Under the bonnet service paths are represented with a class (ServicePath) that's a tree-like structure to encode the concept of FIWARE entity hierarchy where each node holds the name of a path component.
Describe the solution you'd like
Change the returned data format from (using simplified YAML representation instead of actual JSON)
Keep the current format and document the meaning of the children fields.
Additional context
For the record, here's the algo we designed in yesterday's session to do the job. We specified it directly in Haskell because Haskell lets you easily express maths ideas in code. Copy-paste into an online compiler, e.g.
-- canonical recursive tree structuredataTree=NInt [Tree]
-- path type alias for clarity (a path is a sequence of nodes)typePath= [Int]
-- example tree
t =N1
[ N2 [N3[], N4[]]
, N5
[ N6 [N7[], N8[]]
, N9[]
]
]
-- extract root-to-leaf pathspaths::Tree-> [Path]
paths (N v []) = [[v]]
paths (N v ts) =map (v:) (concatMap paths ts)
-- print t's root-to-leaf paths
result = paths t
main =mapM_ (putStrLn.show) $ result
If you run it, you'll see this output
[1,2,3]
[1,2,4]
[1,5,6,7]
[1,5,6,8]
[1,5,9]
As expected, since the program actually embodies a "proof of correctness".
The text was updated successfully, but these errors were encountered:
Keep in mind that as @Cerfoglg pointed out, this isn't really an issue when retrieving service paths individually since there's only one children field in that case and nodes won't be repeated. See also: #221.
Is your feature request related to a problem? Please describe.
The FIWARE service paths endpoint returns alot of extra fields besides the actual paths. In particular, for each path
p
there's achildren
field that contains the whole service path tree starting from the last node ofp
. Perhaps this is more than clients actually need. (Also, the root path will already contain the whole tree anyway.) We could return just root-to-leaf paths without includingchildren
fields.Note. Under the bonnet service paths are represented with a class (
ServicePath
) that's a tree-like structure to encode the concept of FIWARE entity hierarchy where each node holds the name of a path component.Describe the solution you'd like
Change the returned data format from (using simplified YAML representation instead of actual JSON)
to something simpler e.g. just list root-to-leaf paths and their IDs
Describe alternatives you've considered
Keep the current format and document the meaning of the
children
fields.Additional context
For the record, here's the algo we designed in yesterday's session to do the job. We specified it directly in Haskell because Haskell lets you easily express maths ideas in code. Copy-paste into an online compiler, e.g.
If you run it, you'll see this output
As expected, since the program actually embodies a "proof of correctness".
The text was updated successfully, but these errors were encountered: