lib/json: remove Jsonable and replace it by Serializable
authorAlexandre Terrasa <alexandre@moz-code.org>
Fri, 12 May 2017 05:29:21 +0000 (01:29 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Fri, 12 May 2017 05:29:21 +0000 (01:29 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

23 files changed:
contrib/neo_doxygen/src/model/descriptions.nit
contrib/neo_doxygen/src/model/location.nit
contrib/shibuqam/examples/shibuqamoauth.nit
lib/github/api.nit
lib/github/events.nit
lib/github/github_curl.nit
lib/json/static.nit
lib/json/store.nit
lib/json/string_parser.nit
lib/mongodb/queries.nit
lib/neo4j/curl_json.nit
lib/neo4j/error.nit
lib/neo4j/graph/graph.nit
lib/neo4j/graph/json_graph_store.nit
lib/neo4j/neo4j.nit
lib/popcorn/pop_repos.nit
lib/popcorn/pop_validation.nit
src/doc/doc_phases/doc_indexing.nit
src/examples/nitwebcrawl.nit
src/model/model_json.nit
src/web/api_catalog.nit
src/web/api_metrics.nit
src/web/web_base.nit

index 58ef0e6..66341f3 100644 (file)
@@ -51,7 +51,7 @@ import json
 # assert doc.to_json == "[]"
 # ~~~
 class Documentation
-       super Jsonable
+       super Serializable
 
        private var content = new JsonStringArray
        private var has_brief_description: Bool = false
@@ -111,7 +111,7 @@ class Documentation
        redef fun accept_json_serializer(v) do content.serialize_to v
 end
 
-# A `Jsonable` array of strings.
+# A `Serializable` array of strings.
 private class JsonStringArray
        super JsonSequenceRead[String]
        super Array[String]
index d5f3727..576a087 100644 (file)
@@ -20,7 +20,7 @@ import json
 
 # A location inside a source file.
 class Location
-       super Jsonable
+       super Serializable
 
        # The file’s path.
        var path: nullable String = null is writable
index 951640e..1aa33f9 100644 (file)
@@ -292,7 +292,7 @@ class AuthHandler
 end
 
 redef class User
-       super Jsonable
+       super Serializable
 end
 
 # Information about an authenticated used stored on the server to be given to the client.
index 17de935..e518f8d 100644 (file)
@@ -116,7 +116,7 @@ class GithubAPI
        #     assert err isa GithubError
        #     assert err.name == "GithubAPIError"
        #     assert err.message == "Not Found"
-       fun get(path: String): nullable Jsonable do
+       fun get(path: String): nullable Serializable do
                path = sanitize_uri(path)
                var res = ghcurl.get_and_parse("{api_url}{path}")
                if res isa Error then
@@ -509,7 +509,6 @@ end
 #
 # Mainly a Nit wrapper around a JSON objet.
 abstract class GithubEntity
-       super Jsonable
        serialize
 
        # Github page url.
@@ -1116,7 +1115,6 @@ end
 
 # Make ISO Datew serilizable
 redef class ISODate
-       super Jsonable
        serialize
 end
 
index 3417de2..f2f398a 100644 (file)
@@ -22,7 +22,6 @@ intrude import json
 
 # Github event stub.
 class GithubEvent
-       super Jsonable
        serialize
 
        # Event ID from Github.
index 026456c..6f28546 100644 (file)
@@ -43,7 +43,7 @@ class GithubCurl
 
        # Get the requested URI, and check the HTTP response. Then convert to JSON
        # and check for Github errors.
-       fun get_and_check(uri: String): nullable Jsonable
+       fun get_and_check(uri: String): nullable Serializable
        do
                var request = new CurlHTTPRequest(uri)
                request.user_agent = user_agent
@@ -74,7 +74,7 @@ class GithubCurl
        # Then convert to JSON and check for Github errors.
        # Unlike `get_and_check`, error do not trigger an abort but
        # are reported as `GithubError`.
-       fun get_and_parse(uri: String): nullable Jsonable
+       fun get_and_parse(uri: String): nullable Serializable
        do
                var request = new CurlHTTPRequest(uri)
                request.user_agent = user_agent
@@ -114,7 +114,7 @@ end
 # Check the `json` value to find them.
 class GithubError
        super Error
-       super Jsonable
+       super Serializable
 
        # The name of the error.
        var name: String
index f5eef1d..9b68f31 100644 (file)
@@ -26,13 +26,7 @@ import error
 private import json_parser
 private import json_lexer
 
-# Something that can be translated to JSON.
-interface Jsonable
-       super Serializable
-end
-
 redef class Text
-       super Jsonable
 
        # Removes JSON-escaping if necessary in a JSON string
        #
@@ -128,7 +122,7 @@ redef class Text
        #     var bad = "\{foo: \"bar\"\}".parse_json
        #     assert bad isa JsonParseError
        #     assert bad.position.col_start == 2
-       fun parse_json: nullable Jsonable do
+       fun parse_json: nullable Serializable do
                var lexer = new Lexer_json(to_s)
                var parser = new Parser_json
                var tokens = lexer.lex
@@ -152,48 +146,28 @@ redef class FlatText
        end
 end
 
-redef class Int
-       super Jsonable
-end
-
-redef class Float
-       super Jsonable
-end
-
-redef class Bool
-       super Jsonable
-end
-
 # A map that can be translated into a JSON object.
-interface JsonMapRead[K: String, V: nullable Jsonable]
+interface JsonMapRead[K: String, V: nullable Serializable]
        super MapRead[K, V]
-       super Jsonable
+       super Serializable
 end
 
 # A JSON Object.
 class JsonObject
-       super JsonMapRead[String, nullable Jsonable]
-       super HashMap[String, nullable Jsonable]
+       super JsonMapRead[String, nullable Serializable]
+       super HashMap[String, nullable Serializable]
 end
 
 # A sequence that can be translated into a JSON array.
-class JsonSequenceRead[E: nullable Jsonable]
-       super Jsonable
+class JsonSequenceRead[E: nullable Serializable]
+       super Serializable
        super SequenceRead[E]
 end
 
 # A JSON array.
 class JsonArray
-       super JsonSequenceRead[nullable Jsonable]
-       super Array[nullable Jsonable]
-end
-
-redef class JsonParseError
-       super Jsonable
-end
-
-redef class Position
-       super Jsonable
+       super JsonSequenceRead[nullable Serializable]
+       super Array[nullable Serializable]
 end
 
 ################################################################################
@@ -201,7 +175,7 @@ end
 
 redef class Nvalue
        # The represented value.
-       private fun to_nit_object: nullable Jsonable is abstract
+       private fun to_nit_object: nullable Serializable is abstract
 end
 
 redef class Nvalue_number
@@ -269,7 +243,7 @@ redef class Npair
        private fun name: String do return n_string.to_nit_string
 
        # The represented value.
-       private fun value: nullable Jsonable do return n_value.to_nit_object
+       private fun value: nullable Serializable do return n_value.to_nit_object
 end
 
 redef class Nvalue_array
index 2f81726..04ed922 100644 (file)
@@ -128,7 +128,7 @@ class JsonStore
        #
        # Only `JsonObject` and `JsonArray` are allowed in a json file.
        # Use `store_object` or `store_array` instead.
-       private fun store_json(key: String, json: Jsonable) do
+       private fun store_json(key: String, json: Serializable) do
                var path = "{store_dir}/{key}.json".simplify_path
                path.dirname.mkdir
                var file = new FileWriter.open(path)
@@ -149,7 +149,7 @@ class JsonStore
        # Load a JsonObject associated to `key` from store.
        #
        # Ensure `has_data(key)`
-       private fun load_json(key: String): nullable Jsonable do
+       private fun load_json(key: String): nullable Serializable do
                assert has_key(key)
                var path = "{store_dir}/{key}.json".simplify_path
                var file = new FileReader.open(path)
index 19c8fd1..5015754 100644 (file)
@@ -54,7 +54,7 @@ class JSONStringParser
        # var p = new JSONStringParser("""{"numbers": [1,23,3], "string": "string"}""")
        # assert p.parse_entity isa JsonObject
        # ~~~
-       fun parse_entity: nullable Jsonable do
+       fun parse_entity: nullable Serializable do
                var srclen = len
                ignore_whitespaces
                if pos >= srclen then return make_parse_error("Empty JSON")
@@ -95,7 +95,7 @@ class JSONStringParser
        end
 
        # Parses a JSON Array
-       fun parse_json_array: Jsonable do
+       fun parse_json_array: Serializable do
                var max = len
                if pos >= max then return make_parse_error("Incomplete JSON array")
                var arr = new JsonArray
@@ -120,7 +120,7 @@ class JSONStringParser
        end
 
        # Parses a JSON Object
-       fun parse_json_object: Jsonable do
+       fun parse_json_object: Serializable do
                var max = len
                if pos >= max then return make_parse_error("Incomplete JSON object")
                var obj = new JsonObject
@@ -160,7 +160,7 @@ class JSONStringParser
        end
 
        # Parses an Int or Float
-       fun parse_json_number: Jsonable do
+       fun parse_json_number: Serializable do
                var max = len
                var p = pos
                var c = src[p]
@@ -234,7 +234,7 @@ class JSONStringParser
        private var parse_str_buf = new FlatBuffer
 
        # Parses and returns a Nit string from a JSON String
-       fun parse_json_string: Jsonable do
+       fun parse_json_string: Serializable do
                var src = src
                var ln = src.length
                var p = pos
index 4b8e9a1..288058d 100644 (file)
@@ -81,7 +81,7 @@ class MongoMatch
        # ~~~json
        # {field: {$<name>: <value>} }
        # ~~~
-       fun op(name: String, field: nullable String, value: nullable Jsonable): MongoMatch do
+       fun op(name: String, field: nullable String, value: nullable Serializable): MongoMatch do
                if field != null then
                        var q = new JsonObject
                        q["${name}"] = value
@@ -99,7 +99,7 @@ class MongoMatch
        # ~~~json
        # {field: {$eq: value} }
        # ~~~
-       fun eq(field: String, value: nullable Jsonable): MongoMatch do
+       fun eq(field: String, value: nullable Serializable): MongoMatch do
                self[field] = value
                return self
        end
@@ -111,7 +111,7 @@ class MongoMatch
        # ~~~json
        # {field: {$ne: value} }
        # ~~~
-       fun ne(field: String, value: nullable Jsonable): MongoMatch do
+       fun ne(field: String, value: nullable Serializable): MongoMatch do
                op("ne", field, value)
                return self
        end
@@ -123,7 +123,7 @@ class MongoMatch
        # ~~~json
        # {field: {$gt: value} }
        # ~~~
-       fun gt(field: String, value: nullable Jsonable): MongoMatch do
+       fun gt(field: String, value: nullable Serializable): MongoMatch do
                op("gt", field, value)
                return self
        end
@@ -135,7 +135,7 @@ class MongoMatch
        # ~~~json
        # {field: {$gte: value} }
        # ~~~
-       fun gte(field: String, value: nullable Jsonable): MongoMatch do
+       fun gte(field: String, value: nullable Serializable): MongoMatch do
                op("gte", field, value)
                return self
        end
@@ -147,7 +147,7 @@ class MongoMatch
        # ~~~json
        # {field: {$lt: value} }
        # ~~~
-       fun lt(field: String, value: nullable Jsonable): MongoMatch do
+       fun lt(field: String, value: nullable Serializable): MongoMatch do
                op("lt", field, value)
                return self
        end
@@ -159,7 +159,7 @@ class MongoMatch
        # ~~~json
        # {field: {$lte: value} }
        # ~~~
-       fun lte(field: String, value: nullable Jsonable): MongoMatch do
+       fun lte(field: String, value: nullable Serializable): MongoMatch do
                op("lte", field, value)
                return self
        end
@@ -210,7 +210,7 @@ class MongoMatch
        #
        # `$in` selects the documents where the value of a field equals any value
        # in the specified array.
-       fun is_in(field: String, values: Array[nullable Jsonable]): MongoMatch do
+       fun is_in(field: String, values: Array[nullable Serializable]): MongoMatch do
                op("in", field, new JsonArray.from(values))
                return self
        end
@@ -226,7 +226,7 @@ class MongoMatch
        # `$nin` selects the documents where:
        # * the field value is not in the specified array or
        # * the field does not exist.
-       fun is_nin(field: String, values: Array[nullable Jsonable]): MongoMatch do
+       fun is_nin(field: String, values: Array[nullable Serializable]): MongoMatch do
                op("nin", field, new JsonArray.from(values))
                return self
        end
@@ -244,7 +244,7 @@ class MongoMatch
        # ~~~json
        # { field: { $or: [ { <expression1> }, { <expression2> }, ... , { <expressionN> } ] } }
        # ~~~
-       fun lor(field: nullable String, expressions: Array[Jsonable]): MongoMatch do
+       fun lor(field: nullable String, expressions: Array[Serializable]): MongoMatch do
                op("or", field, new JsonArray.from(expressions))
                return self
        end
@@ -261,7 +261,7 @@ class MongoMatch
        # ~~~json
        # { field: { $and: [ { <expression1> }, { <expression2> }, ... , { <expressionN> } ] } }
        # ~~~
-       fun land(field: nullable String, expressions: Array[Jsonable]): MongoMatch do
+       fun land(field: nullable String, expressions: Array[Serializable]): MongoMatch do
                op("and", field, new JsonArray.from(expressions))
                return self
        end
@@ -279,7 +279,7 @@ class MongoMatch
        # ~~~json
        # { field: { $not: { <expression> } } }
        # ~~~
-       fun lnot(field: nullable String, expression: Jsonable): MongoMatch do
+       fun lnot(field: nullable String, expression: Serializable): MongoMatch do
                op("not", field, expression)
                return self
        end
@@ -297,7 +297,7 @@ class MongoMatch
        # ~~~json
        # { field: { $nor: [ { <expression1> }, { <expression2> }, ... , { <expressionN> } ] } }
        # ~~~
-       fun lnor(field: nullable String, expressions: Array[Jsonable]): MongoMatch do
+       fun lnor(field: nullable String, expressions: Array[Serializable]): MongoMatch do
                op("nor", field, new JsonArray.from(expressions))
                return self
        end
@@ -312,7 +312,7 @@ class MongoMatch
        # ~~~json
        # { field: { $all: [ <value1>, <value2>, ... ] } }
        # ~~~
-       fun all(field: nullable String, values: Array[Jsonable]): MongoMatch do
+       fun all(field: nullable String, values: Array[Serializable]): MongoMatch do
                op("all", field, new JsonArray.from(values))
                return self
        end
@@ -327,7 +327,7 @@ class MongoMatch
        # ~~~json
        # { field: { $elemMatch: <query> } }
        # ~~~
-       fun elem_match(field: nullable String, query: Jsonable): MongoMatch do
+       fun elem_match(field: nullable String, query: Serializable): MongoMatch do
                op("elemMatch", field, query)
                return self
        end
@@ -383,7 +383,7 @@ class MongoPipeline
        # ~~~json
        # { $<stage>: <json> }
        # ~~~
-       fun add_stage(stage: String, json: Jsonable): MongoPipeline do
+       fun add_stage(stage: String, json: Serializable): MongoPipeline do
                var obj = new JsonObject
                obj["${stage}"] = json
                add obj
@@ -540,7 +540,7 @@ class MongoGroup
        # ~~~json
        # <field>: { <accumulator> : <expression> }
        # ~~~
-       private fun acc(name: String, field: String, expression: nullable Jsonable): MongoGroup do
+       private fun acc(name: String, field: String, expression: nullable Serializable): MongoGroup do
                var q = new JsonObject
                q["${name}"] = expression
                self[field] = q
@@ -556,7 +556,7 @@ class MongoGroup
        # ~~~
        #
        # `$sum` ignores non-numeric values.
-       fun sum(field: String, expression: Jsonable): MongoGroup do
+       fun sum(field: String, expression: Serializable): MongoGroup do
                return acc("sum", field, expression)
        end
 
@@ -569,7 +569,7 @@ class MongoGroup
        # ~~~
        #
        # `$avg` ignores non-numeric values.
-       fun avg(field: String, expression: Jsonable): MongoGroup do
+       fun avg(field: String, expression: Serializable): MongoGroup do
                return acc("avg", field, expression)
        end
 
@@ -583,7 +583,7 @@ class MongoGroup
        #
        # `$max` compares both value and type, using the specified BSON comparison
        # order for values of different types.
-       fun max(field: String, expression: Jsonable): MongoGroup do
+       fun max(field: String, expression: Serializable): MongoGroup do
                return acc("max", field, expression)
        end
 
@@ -597,7 +597,7 @@ class MongoGroup
        #
        # `$min` compares both value and type, using the specified BSON comparison
        # order for values of different types.
-       fun min(field: String, expression: Jsonable): MongoGroup do
+       fun min(field: String, expression: Serializable): MongoGroup do
                return acc("min", field, expression)
        end
 
@@ -613,7 +613,7 @@ class MongoGroup
        # document in a group of documents that share the same group by key.
        #
        # Only meaningful when documents are in a defined order.
-       fun first(field: String, expression: Jsonable): MongoGroup do
+       fun first(field: String, expression: Serializable): MongoGroup do
                return acc("first", field, expression)
        end
 
@@ -629,7 +629,7 @@ class MongoGroup
        # document in a group of documents that share the same group by key.
        #
        # Only meaningful when documents are in a defined order.
-       fun last(field: String, expression: Jsonable): MongoGroup do
+       fun last(field: String, expression: Serializable): MongoGroup do
                return acc("last", field, expression)
        end
 
@@ -643,7 +643,7 @@ class MongoGroup
        #
        # Returns an array of all values that result from applying an expression to
        # each document in a group of documents that share the same group by key.
-       fun push(field: String, expr: Jsonable): MongoGroup do
+       fun push(field: String, expr: Serializable): MongoGroup do
                return acc("push", field, expr)
        end
 
@@ -660,7 +660,7 @@ class MongoGroup
        # group by key.
        #
        # Order of the elements in the output array is unspecified.
-       fun addToSet(field: String, expr: Jsonable): MongoGroup do
+       fun addToSet(field: String, expr: Serializable): MongoGroup do
                return acc("addToSet", field, expr)
        end
 end
index f2a541f..d6c4275 100644 (file)
@@ -107,7 +107,7 @@ end
 class JsonPOST
        super JsonCurlRequest
 
-       var json_data: nullable Jsonable = null is writable
+       var json_data: nullable Serializable = null is writable
 
        redef fun init_headers do
                super
@@ -142,7 +142,7 @@ end
 class JsonPUT
        super JsonCurlRequest
 
-       var json_data: nullable Jsonable = null is writable
+       var json_data: nullable Serializable = null is writable
 
        redef fun init_headers do
                super
@@ -161,4 +161,3 @@ class JsonPUT
                return null
        end
 end
-
index 58068ad..140606c 100644 (file)
@@ -20,7 +20,6 @@ import json
 #     assert error.to_json == """{"message":"ErrorMessage","cause":null,"error":"ErrorName"}"""
 class NeoError
        super Error
-       super Jsonable
        serialize
 
        # The name of the error.
index 12a2b9f..d3be0d5 100644 (file)
@@ -47,7 +47,7 @@ abstract class NeoNodeCollection
        super SimpleCollection[NeoNode]
 
        # The type of the local IDs.
-       type ID_TYPE: Jsonable
+       type ID_TYPE: Serializable
 
        # The property of the nodes that hold the local ID.
        var id_property: String
index d924bd9..16ad037 100644 (file)
@@ -111,7 +111,7 @@ class JsonGraphStore
 end
 
 redef class NeoGraph
-       super Jsonable
+       super Serializable
 
        # Retrieve the graph from the specified JSON document.
        #
@@ -217,7 +217,7 @@ end
 
 redef class NeoNodeCollection
        # Convert the specified JSON value into a local ID.
-       fun id_from_jsonable(id: nullable Jsonable): ID_TYPE do return id.as(ID_TYPE)
+       fun id_from_jsonable(id: nullable Serializable): ID_TYPE do return id.as(ID_TYPE)
 end
 
 redef class NeoEntity
@@ -226,9 +226,9 @@ redef class NeoEntity
        fun append_json_for(graph: NeoGraph, v: JsonSerializer) is abstract
 end
 
-# Make `NeoNode` `Jsonable`.
+# Make `NeoNode` `Serializable`.
 redef class NeoNode
-       super Jsonable
+       super Serializable
 
        # Retrieve the node from the specified JSON value.
        #
index 3dffc93..f054423 100644 (file)
@@ -124,7 +124,7 @@ class Neo4jClient
                self.cypher_url = root["cypher"].to_s
        end
 
-       fun service_root: Jsonable do return get(base_url / "db/data")
+       fun service_root: Serializable do return get(base_url / "db/data")
 
        # Is the connection with the Neo4j server ok?
        fun is_ok: Bool do return service_root isa JsonObject
@@ -314,19 +314,19 @@ class Neo4jClient
 
        # Perform a `CypherQuery`
        # see: CypherQuery
-       fun cypher(query: CypherQuery): Jsonable do
+       fun cypher(query: CypherQuery): Serializable do
                return post("{cypher_url}", query.to_rest)
        end
 
        # GET JSON data from `url`
-       fun get(url: String): Jsonable do
+       fun get(url: String): Serializable do
                var request = new JsonGET(url)
                var response = request.execute
                return parse_response(response)
        end
 
        # POST `params` to `url`
-       fun post(url: String, params: Jsonable): Jsonable do
+       fun post(url: String, params: Serializable): Serializable do
                var request = new JsonPOST(url)
                request.json_data = params
                var response = request.execute
@@ -334,7 +334,7 @@ class Neo4jClient
        end
 
        # PUT `params` at `url`
-       fun put(url: String, params: Jsonable): Jsonable do
+       fun put(url: String, params: Serializable): Serializable do
                var request = new JsonPUT(url)
                request.json_data = params
                var response = request.execute
@@ -342,14 +342,14 @@ class Neo4jClient
        end
 
        # DELETE `url`
-       fun delete(url: String): Jsonable do
+       fun delete(url: String): Serializable do
                var request = new JsonDELETE(url)
                var response = request.execute
                return parse_response(response)
        end
 
        # Parse the cURL `response` as a JSON string
-       private fun parse_response(response: CurlResponse): Jsonable do
+       private fun parse_response(response: CurlResponse): Serializable do
                if response isa CurlResponseSuccess then
                        var str = response.body_str
                        if str.is_empty then return new JsonObject
@@ -551,13 +551,13 @@ abstract class NeoEntity
        end
 
        # Get the entity property at `key`
-       fun [](key: String): nullable Jsonable do
+       fun [](key: String): nullable Serializable do
                if not properties.has_key(key) then return null
                return properties[key]
        end
 
        # Set the entity property `value` at `key`
-       fun []=(key: String, value: nullable Jsonable) do properties[key] = value
+       fun []=(key: String, value: nullable Serializable) do properties[key] = value
 
        # Is the property `key` set?
        fun has_key(key: String): Bool do return properties.has_key(key)
@@ -923,7 +923,7 @@ class NeoBatch
        end
 
        # Associate data from response in original nodes and edges
-       private fun finalize_batch(response: Jsonable): List[NeoError] do
+       private fun finalize_batch(response: Serializable): List[NeoError] do
                var errors = new List[NeoError]
                if not response isa JsonArray then
                        errors.add(new NeoError("Unexpected batch response format.", "Neo4jError"))
@@ -1013,7 +1013,7 @@ class NeoJob
        # Job service target: `/node`, `/labels` etc...
        var to: String
        # Body to send with the job service request
-       var body: nullable Jsonable = null
+       var body: nullable Serializable = null
 
        # JSON formated job
        fun to_rest: JsonObject do
index 1f12853..3bdf2b0 100644 (file)
@@ -41,7 +41,6 @@
 # # Serializable book representation.
 # class Book
 #      serialize
-#      super Jsonable
 #
 #      # Book uniq ID
 #      var id: String = (new MongoObjectId).id is serialize_as "_id"
@@ -407,7 +406,6 @@ end
 # end
 # ~~~
 abstract class RepoObject
-       super Jsonable
        serialize
 
        # `self` unique id.
index b1464b8..181c47a 100644 (file)
@@ -28,7 +28,7 @@
 #
 # # Serializable book representation.
 # class Book
-#      super Jsonable
+#      super Serializable
 #
 #      # Book ISBN
 #      var isbn: String
@@ -98,7 +98,7 @@ end
 #
 # See `HttpResponse::json_error`.
 class ValidationResult
-       super Jsonable
+       super Serializable
 
        # Object parsed during validation
        #
@@ -199,8 +199,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
@@ -251,8 +251,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
index 066f8ab..267c746 100644 (file)
@@ -95,7 +95,6 @@ end
 
 # A QuickSearch result.
 private class QuickSearchResult
-       super Jsonable
        serialize
 
        # The text of the link.
index e981ac6..8199c16 100644 (file)
@@ -32,7 +32,7 @@ fun curl(url: String): String do
 end
 
 # Recursively collect all string values in a json value associated to a given key.
-fun search_json(json: nullable Jsonable, key: String, result: nullable Array[String]): Array[String]
+fun search_json(json: nullable Serializable, key: String, result: nullable Array[String]): Array[String]
 do
        if result == null then result = new Array[String]
        if json isa JsonObject then
index 8fe8754..e6c6896 100644 (file)
@@ -12,7 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# Make model entities Jsonable.
+# Make model entities Serializable.
 #
 # To avoid cycles, every reference from a MEntity to another is replaced by a
 # MEntityRef.
@@ -42,7 +42,6 @@ class MEntityRef
 end
 
 redef class MEntity
-       super Jsonable
        serialize
 
        redef fun core_serialize_to(v) do
@@ -88,7 +87,6 @@ redef class MEntity
 end
 
 redef class MDoc
-       super Jsonable
        serialize
 
        redef fun core_serialize_to(v) do
@@ -99,7 +97,6 @@ redef class MDoc
 end
 
 redef class Location
-       super Jsonable
        serialize
 
        redef fun core_serialize_to(v) do
index 3a4bb19..678f514 100644 (file)
@@ -140,7 +140,7 @@ class APICatalogContributors
 end
 
 redef class Person
-       super Jsonable
+       super Serializable
 
        redef fun core_serialize_to(v) do
                v.serialize_attribute("name", name)
index cc57e40..03518e4 100644 (file)
@@ -152,7 +152,7 @@ redef class MClass
 end
 
 redef class MetricSet
-       super Jsonable
+       super Serializable
 
        redef fun core_serialize_to(v) do
                for metric in metrics do
@@ -162,7 +162,7 @@ redef class MetricSet
 end
 
 redef class Metric
-       super Jsonable
+       super Serializable
 
        redef fun core_serialize_to(v) do
                v.serialize_attribute("name", name)
@@ -215,7 +215,7 @@ redef class MClassMetric
 end
 
 private class MetricEntry
-       super Jsonable
+       super Serializable
 
        var mentity: MEntity
        var value: Object
index 351d7a6..8062768 100644 (file)
@@ -118,7 +118,6 @@ end
 #
 # Can be serialized to json.
 class APIError
-       super Jsonable
        serialize
 
        # Reponse status
@@ -147,7 +146,7 @@ end
 # * a `NSToken` for tokens like `::`, `>` and `$`
 # * a `MSRef` for references to mentities
 interface NSEntity
-       super Jsonable
+       super Serializable
 end
 
 # A reference to a MEntity that can be rendered as a link.
@@ -336,7 +335,7 @@ redef class MVirtualType
 end
 
 redef class POSetElement[E]
-       super Jsonable
+       super Serializable
 
        redef fun serialize_to(v) do
                assert self isa POSetElement[MEntity]