sjkaliski / pinned

📌 Date based versioning system for Go APIs.
MIT License
88 stars 5 forks source link

version deprecation #10

Closed sjkaliski closed 6 years ago

sjkaliski commented 6 years ago

A version can be marked as Deprecated. Now when a client is making a request to a deprecated version, it can be detected easily:


func handler(w http.ResponseWriter, r *http.Request) {
  v, err := vm.Parse(r)
  if err == pinned. ErrVersionDeprecated {
    // Notify client to upgrade.
  }

  // version, v, is not nil.
}