geometry: move up `Point3d::offset` from gamnit
[nit.git] / src / web / api_catalog.nit
index 30b8757..678f514 100644 (file)
@@ -20,7 +20,12 @@ import catalog
 redef class NitwebConfig
 
        # Catalog to pass to handlers.
-       var catalog: Catalog is lazy do
+       var catalog: Catalog is noinit
+
+       # Build the catalog
+       #
+       # This method should be called at nitweb startup.
+       fun build_catalog do
                var catalog = new Catalog(modelbuilder)
                for mpackage in model.mpackages do
                        catalog.deps.add_node(mpackage)
@@ -36,7 +41,7 @@ redef class NitwebConfig
                        catalog.git_info(mpackage)
                        catalog.package_page(mpackage)
                end
-               return catalog
+               self.catalog = catalog
        end
 end
 
@@ -135,14 +140,12 @@ class APICatalogContributors
 end
 
 redef class Person
-       super Jsonable
+       super Serializable
 
-       redef fun to_json do
-               var obj = new JsonObject
-               obj["name"] = name
-               obj["email"] = email
-               obj["page"] = page
-               obj["hash"] = (email or else "").md5.to_lower
-               return obj.to_json
+       redef fun core_serialize_to(v) do
+               v.serialize_attribute("name", name)
+               v.serialize_attribute("email", email)
+               v.serialize_attribute("page", page)
+               v.serialize_attribute("hash", (email or else "").md5.to_lower)
        end
 end