]> git.ipfire.org Git - thirdparty/patchwork.git/commit
REST: Remove '_url' suffixes
authorStephen Finucane <stephen@that.guru>
Thu, 24 Nov 2016 09:33:53 +0000 (09:33 +0000)
committerStephen Finucane <stephen@that.guru>
Fri, 23 Dec 2016 23:37:02 +0000 (23:37 +0000)
commitd4939247040d07d8b63e3fe65207ee6e3f509c60
treeb55fb1579859df1614c4041e2a549a1357aaee54
parent4f936cefabc77772c20b11bc2b741ece2c66ea72
REST: Remove '_url' suffixes

This was a design decision made when implementing the REST API. The
idea was that these items were URLs to related objects and should be
indicated as such. However, this was a faulty assumption as the
Patchwork API, unlike other some other APIs (GitHub), does not also
include a full representation of said objects, like so:

    {
      "url": "http://localhost:8000/api/1.0/patches/1/",
      ...
      "delegate_url": "http://localhost:8000/api/1.0/users/1",
      "delegate": {
        "url": "http://localhost:8000/api/1.0/users/1/",
        "username": "admin",
        "first_name": "",
        "last_name": "",
        "email": ""
      }
    }

Since there is no intention to support this design yet, there isn't
really any reason to fight django-rest-framework in appending these
suffixes. Simply remove them. This changes the output for most endpoints
from something like this:

    {
      "url": "http://localhost:8000/api/1.0/patches/1",
      ...
      "delegate_url": "http://localhost:8000/api/1.0/users/1"
    }

to:

    {
      "url": "http://localhost:8000/api/1.0/patches/1",
      ...
      "delegate": "http://localhost:8000/api/1.0/users/1"
    }

This will affect all endpoints with nested resources.

Note that the API version is not bumped as the API is still considered
unreleased.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
Reviewed-by: Daniel Axtens <dja@axtens.net>
patchwork/api/base.py
patchwork/api/check.py
patchwork/api/patch.py
patchwork/api/person.py
patchwork/tests/test_rest_api.py