Bug: Inconsistent repository fields between webhook events


The push webhook has the following fields in the repository:

    "created_at": 1486091472,
    "updated_at": "2017-04-12T21:26:13Z",
    "pushed_at": 1500247643,

While other webhooks, like create, have the following:

    "created_at": "2017-02-03T03:11:12Z",
    "updated_at": "2017-04-12T21:26:13Z",
    "pushed_at": "2017-07-16T23:27:23Z",

This is really unfortunate because these kind of differences are very difficult to deal with in JSON decoding in languages like Go or Swift.


Thanks for the report, @st3fan, I’ve opened an issue internally about this. We’ll let you know when we have updates about it.


Thanks! Grealty appreciated!


@st3fan here’s what we found:

The inconsistency between the formats of the different fields in the push event is known, at least by the people who manage the webhooks. The origin of this is murky—the TL;DR version of that is “historical reasons”. The push event is one of the oldest events in the API.

The problem with changing the format of an existing field is that this would break a huge number of apps and scripts. We could do it, but not everyone follows the change blog, and we currently don’t have a consistent way of messaging small (but -ahem- powerful) changes like this.

We will, eventually make a major version update of all the webhooks, at which point we will make these fields consistent.

On the positive side, the fields that are ISO-8601 strings are always ISO-8601 strings, and the fields that are Epoch integers are always Epoch integers, so while the inconsistency is understandably annoying, defining the types in Go or Swift should not be a problem, since any one field will always have a consistent format.

Speaking as a Go developer with a very strong preference for consistency, I feel your pain :heart: