geometry: move up custom `to_s` to the interfaces
[nit.git] / lib / popcorn / pop_validation.nit
index ad66fb5..e95e517 100644 (file)
@@ -28,7 +28,7 @@
 #
 # # Serializable book representation.
 # class Book
-#      super Jsonable
+#      super Serializable
 #
 #      # Book ISBN
 #      var isbn: String
@@ -61,7 +61,7 @@
 #      redef fun post(req, res) do
 #              var validator = new BookValidator
 #              if not validator.validate(req.body) then
-#                      res.json_error(validator.validation, 400)
+#                      res.json(validator.validation, 400)
 #                      return
 #              end
 #              # TODO data persistence
@@ -95,10 +95,8 @@ end
 #
 # Errors messages are grouped into *scopes*. A scope is a string that specify wich
 # field or document the error message is related to.
-#
-# See `HttpResponse::json_error`.
 class ValidationResult
-       super Jsonable
+       super Serializable
 
        # Object parsed during validation
        #
@@ -194,8 +192,8 @@ class ObjectValidator
                return validate_json(json)
        end
 
-       # Validate a Jsonable input
-       fun validate_json(json: Jsonable): Bool do
+       # Validate a Serializable input
+       fun validate_json(json: Serializable): Bool do
                if not json isa JsonObject then
                        validation.add_error("document", "Expected JsonObject got `{json.class_name}`")
                        return false
@@ -246,8 +244,8 @@ class ArrayValidator
                return validate_json(json)
        end
 
-       # Validate a Jsonable input
-       fun validate_json(json: Jsonable): Bool do
+       # Validate a Serializable input
+       fun validate_json(json: Serializable): Bool do
                if not json isa JsonArray then
                        validation.add_error("document", "Expected JsonArray got `{json.class_name}`")
                        return false