github :: GithubDeserializer :: url_heuristic
Matchurl property in object to a class name
			github :: GithubDeserializer :: url_patterns
Url patterns to class namesgithub :: GithubDeserializer :: url_patterns=
Url patterns to class namesgithub $ GithubDeserializer :: SELF
Type of this instance, automatically specialized in every classgithub $ GithubDeserializer :: class_name_heuristic
User customizable heuristic to infer the name of the Nit class to deserializejson_object
			github :: events $ GithubDeserializer :: class_name_heuristic
User customizable heuristic to infer the name of the Nit class to deserializejson_object
			github $ GithubDeserializer :: deserialize_class
Deserialize the next available object as an instance ofclass_name
			serialization :: SafeDeserializer :: accept
Shouldself accept to deserialize an instance of dynamic_type for an attribute wuth static_type?
			serialization :: Serializable :: accept_json_serializer
Refinable service to customize the serialization of this class to JSONserialization :: Serializable :: accept_msgpack_attribute_counter
Hook to customize the behavior of theAttributeCounter
			serialization :: Serializable :: accept_msgpack_serializer
Hook to customize the serialization of this class to MessagePackserialization :: Serializable :: add_to_bundle
Called by[]= to dynamically choose the appropriate method according
			json :: JsonDeserializer :: attributes_path
Names of the attributes from the root to the object currently being deserializedjson :: JsonDeserializer :: attributes_path=
Names of the attributes from the root to the object currently being deserializedserialization :: CachingDeserializer :: cache=
Cache of known objectsserialization :: SafeDeserializer :: check_subtypes
Should objects be checked if they a subtype of the static type before deserialization?serialization :: SafeDeserializer :: check_subtypes=
Should objects be checked if they a subtype of the static type before deserialization?core :: Object :: class_factory
Implementation used byget_class to create the specific class.
			json :: JsonDeserializer :: class_name_heuristic
User customizable heuristic to infer the name of the Nit class to deserializejson_object
			serialization :: Serializable :: core_serialize_to
Actual serialization ofself to serializer
			json :: JsonDeserializer :: defaultinit
core :: Object :: defaultinit
serialization :: Deserializer :: deserialize
Deserialize and return an object, storing errors in the attributeerrors
			serialization :: Deserializer :: deserialize_attribute
Deserialize the attribute withname from the object open for deserialization
			serialization :: Deserializer :: deserialize_attribute_missing
Was the attribute queried by the last call todeserialize_attribute missing?
			serialization :: Deserializer :: deserialize_attribute_missing=
Was the attribute queried by the last call todeserialize_attribute missing?
			serialization :: Deserializer :: deserialize_class
Deserialize the next available object as an instance ofclass_name
			serialization :: Deserializer :: deserialize_class_intern
Generated service to deserialize the next available object as an instance ofclass_name
			serialization :: Deserializer :: errors
Errors encountered in the last call todeserialize
			serialization :: Deserializer :: errors=
Errors encountered in the last call todeserialize
			serialization :: Serializable :: from_deserializer
Create an instance of this class from thedeserializer
			core :: Object :: is_same_instance
Return true ifself and other are the same instance (i.e. same identity).
			core :: Object :: is_same_serialized
Isself the same as other in a serialization context?
			core :: Object :: is_same_type
Return true ifself and other have the same dynamic type.
			json :: JsonDeserializer :: just_opened_id
Last encountered object reference id.json :: JsonDeserializer :: just_opened_id=
Last encountered object reference id.serialization :: Deserializer :: keep_going
Shouldself keep trying to deserialize an object after an error?
			serialization :: Deserializer :: keep_going=
Shouldself keep trying to deserialize an object after an error?
			serialization :: Serializable :: msgpack_extra_array_items
Hook to request a larger than usual metadata arrayserialization :: Deserializer :: notify_of_creation
Register a newly allocated object (even if not completely built)core :: Object :: output_class_name
Display class name on stdout (debug only).serialization :: Serializable :: serialize_msgpack
Serializeself to MessagePack bytes
			serialization :: Serializable :: serialize_to
Serializeself to serializer
			serialization :: Serializable :: serialize_to_json
Serializeself to JSON
			serialization :: Serializable :: to_pretty_json
Serializeself to plain pretty JSON
			github :: GithubDeserializer :: url_heuristic
Matchurl property in object to a class name
			github :: GithubDeserializer :: url_patterns
Url patterns to class namesgithub :: GithubDeserializer :: url_patterns=
Url patterns to class namesserialization :: SafeDeserializer :: whitelist
Accepted parameterized classes to deserializeserialization :: SafeDeserializer :: whitelist=
Accepted parameterized classes to deserializeserialization :: SafeDeserializer
Deserialization engine limiting which types can be deserializedSerializer::serialize
			
# JsonDeserializer specific for Github objects.
class GithubDeserializer
	super JsonDeserializer
	private var pattern_base = "https://api.github.com"
	# Url patterns to class names
	var url_patterns: Map[Regex, String] is lazy do
		var map = new HashMap[Regex, String]
		map["{pattern_base}/users/[^/]*$".to_re] = "User"
		map["{pattern_base}/repos/[^/]*/[^/]*$".to_re] = "Repo"
		map["{pattern_base}/repos/[^/]*/[^/]*/labels/[^/]+$".to_re] = "Label"
		map["{pattern_base}/repos/[^/]*/[^/]*/milestones/[0-9]+$".to_re] = "Milestone"
		map["{pattern_base}/repos/[^/]*/[^/]*/issues/[0-9]+$".to_re] = "Issue"
		map["{pattern_base}/repos/[^/]*/[^/]*/issues/comments/[0-9]+$".to_re] = "IssueComment"
		map["{pattern_base}/repos/[^/]*/[^/]*/issues/events/[0-9]+$".to_re] = "IssueEvent"
		map["{pattern_base}/repos/[^/]*/[^/]*/pulls/[0-9]+$".to_re] = "PullRequest"
		map["{pattern_base}/repos/[^/]*/[^/]*/pulls/comments/[0-9]+$".to_re] = "PullComment"
		map["{pattern_base}/repos/[^/]*/[^/]*/comments/[0-9]+$".to_re] = "CommitComment"
		map["{pattern_base}/repos/[^/]*/[^/]*/commits/[a-f0-9]+$".to_re] = "Commit"
		map["{pattern_base}/repos/[^/]*/[^/]*/commits/[a-f0-9]+/status$".to_re] = "CommitStatus"
		map["{pattern_base}/repos/[^/]*/[^/]*/statuses/[a-f0-9]+$".to_re] = "RepoStatus"
		return map
	end
	# Match `url` property in object to a class name
	fun url_heuristic(raw: Map[String, nullable Object]): nullable String do
		if not raw.has_key("url") then return null
		var url = raw["url"].as(String)
		for re, class_name in url_patterns do
			if url.has(re) then return class_name
		end
		return null
	end
	redef fun class_name_heuristic(raw) do
		# Try with url
		var class_name = url_heuristic(raw)
		if class_name != null then return class_name
		# print raw.serialize_to_json(true, true) # debug
		# Use properties heuristics
		if raw.has_key("name") and raw.has_key("commit") then
			return "Branch"
		else if raw.has_key("total_count") and raw.has_key("items") then
			return "SearchResults"
		else if raw.has_key("total") and raw.has_key("weeks") then
			return "ContributorStats"
		else if raw.has_key("a") and raw.has_key("d") and raw.has_key("c") then
			return "ContributorWeek"
		end
		return null
	end
	redef fun deserialize_class(name) do
		if name == "Issue" then
			var issue = super.as(Issue)
			if path.last.has_key("pull_request") then
				issue.is_pull_request = true
			end
			return issue
		else if name == "Commit" then
			var commit = super.as(Commit)
			var git_commit = commit.commit
			if git_commit != null then commit.message = git_commit.message
			return commit
		end
		return super
	end
end
					lib/github/api.nit:1075,1--1146,3
				
redef class GithubDeserializer
	redef fun class_name_heuristic(json_object) do
		if json_object.has_key("action") and json_object.has_key("commit") and json_object.has_key("comment") then
			return "CommitCommentEvent"
		else if json_object.has_key("ref") and json_object.has_key("master_branch") then
			return "CreateEvent"
		else if json_object.has_key("ref") and json_object.has_key("ref_type") then
			return "DeleteEvent"
		else if json_object.has_key("action") and json_object.has_key("sha") then
			return "DeploymentEvent"
		else if json_object.has_key("action") and json_object.has_key("state") then
			return "DeploymentStatusEvent"
		else if json_object.has_key("action") and json_object.has_key("forkee") then
			return "ForkEvent"
		else if json_object.has_key("action") and json_object.has_key("issue") and json_object.has_key("comment") then
			return "IssueCommentEvent"
		else if json_object.has_key("action") and json_object.has_key("issue") then
			return "IssuesEvent"
		else if json_object.has_key("action") and json_object.has_key("member") then
			return "MemberEvent"
		else if json_object.has_key("action") and json_object.has_key("number") then
			return "PullRequestEvent"
		else if json_object.has_key("action") and json_object.has_key("pull") and json_object.has_key("comment") then
			return "PullRequestPullCommentEvent"
		else if json_object.has_key("head_commit") and json_object.has_key("commits") then
			return "PushEvent"
		else if json_object.has_key("action") and json_object.has_key("branches") then
			return "StatusEvent"
		else if json_object.has_key("action") and json_object.has_key("issue") then
			return "GithubEvent"
		end
		return super
	end
end
					lib/github/events.nit:247,1--281,3