nitdoc: api returns defs for packages and groups
authorAlexandre Terrasa <alexandre@moz-code.org>
Sat, 17 Jun 2017 21:45:01 +0000 (17:45 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Tue, 15 Aug 2017 18:25:14 +0000 (14:25 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/web/api_model.nit

index d81a3a7..4f1a148 100644 (file)
@@ -211,7 +211,13 @@ class APIEntityDefs
                var mentity = mentity_from_uri(req, res)
                if mentity == null then return
                var mentities: Array[MEntity]
-               if mentity isa MModule then
+               if mentity isa MPackage then
+                       mentities = mentity.mgroups.to_a
+               else if mentity isa MGroup then
+                       mentities = new Array[MEntity]
+                       mentities.add_all mentity.in_nesting.direct_smallers
+                       mentities.add_all mentity.mmodules
+               else if mentity isa MModule then
                        mentities = mentity.mclassdefs
                else if mentity isa MClass then
                        mentities = mentity.mclassdefs