summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
5194886)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
use("/uml/:id", new APIEntityUML(model, mainmodule))
use("/linearization/:id", new APIEntityLinearization(model, mainmodule))
use("/defs/:id", new APIEntityDefs(model, mainmodule))
use("/uml/:id", new APIEntityUML(model, mainmodule))
use("/linearization/:id", new APIEntityLinearization(model, mainmodule))
use("/defs/:id", new APIEntityDefs(model, mainmodule))
+ use("/inheritance/:id", new APIEntityInheritance(model, mainmodule))
+# List ancestors, parents, child and descendants of MEntity
+#
+# Example: `GET /entity/core::Array/inheritance`
+class APIEntityInheritance
+ super APIHandler
+
+ redef fun get(req, res) do
+ var mentity = mentity_from_uri(req, res)
+ if mentity == null then
+ res.error 404
+ return
+ end
+ res.json mentity.hierarchy_poset(view)[mentity]
+ end
+end
+
# Linearize super definitions of a MClassDef or a MPropDef if any.
#
# Example: `GET /entity/core::Array/linearization`
# Linearize super definitions of a MClassDef or a MPropDef if any.
#
# Example: `GET /entity/core::Array/linearization`
redef class MVirtualType
redef var web_url = mproperty.web_url is lazy
end
redef class MVirtualType
redef var web_url = mproperty.web_url is lazy
end
+
+redef class POSetElement[E]
+ super Jsonable
+
+ # Return JSON representation of `self`.
+ fun json: JsonObject do
+ assert self isa POSetElement[MEntity]
+ var obj = new JsonObject
+ obj["greaters"] = to_mentity_refs(greaters)
+ obj["direct_greaters"] = to_mentity_refs(direct_greaters)
+ obj["direct_smallers"] = to_mentity_refs(direct_smallers)
+ obj["smallers"] = to_mentity_refs(smallers)
+ return obj
+ end
+
+ redef fun to_json do return json.to_json
+end