Skip to content

Commit 072212b

Browse files
authored
API v3: remove last_build expandable field (#11730)
* API v3: remove last_build expandable field * Remove internal notes
1 parent 88c7c04 commit 072212b

File tree

5 files changed

+6
-68
lines changed

5 files changed

+6
-68
lines changed

docs/user/api/v3.rst

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,8 @@ Project details
287287
}
288288

289289
:query string expand: Add additional fields in the response.
290-
Allowed values are ``active_versions``, ``active_versions.last_build`` and
291-
``active_versions.last_build.config``. Multiple fields can be passed separated by commas.
290+
Allowed values are: ``active_versions``.
291+
Multiple fields can be passed separated by commas.
292292

293293
.. note::
294294

@@ -588,7 +588,6 @@ Version detail
588588
"aliases": ["VERSION"],
589589
"hidden": false,
590590
"type": "tag",
591-
"last_build": "{BUILD}",
592591
"privacy_level": "public",
593592
"downloads": {
594593
"pdf": "https://pip.readthedocs.io/_/downloads/pdf/pip/stable/",
@@ -613,10 +612,6 @@ Version detail
613612
``null`` when it's not the stable version.
614613
:>json boolean built: the version has at least one successful build.
615614

616-
:query string expand: Add additional fields in the response.
617-
Allowed values are ``last_build`` and ``last_build.config``.
618-
Multiple fields can be passed separated by commas.
619-
620615
Version update
621616
++++++++++++++
622617

readthedocs/api/v3/serializers.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,6 @@ class Meta:
357357
"privacy_level",
358358
]
359359

360-
expandable_fields = {"last_build": (BuildSerializer,)}
361-
362360
def __init__(self, *args, resolver=None, version_serializer=None, **kwargs):
363361
super().__init__(*args, **kwargs)
364362

readthedocs/api/v3/tests/responses/projects-detail.json

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,6 @@
1212
},
1313
"id": 2,
1414
"identifier": "a1b2c3",
15-
"last_build": {
16-
"commit": "a1b2c3",
17-
"config": {
18-
"property": "test value"
19-
},
20-
"created": "2019-04-29T10:00:00Z",
21-
"duration": 60,
22-
"error": "",
23-
"finished": "2019-04-29T10:01:00Z",
24-
"id": 1,
25-
"_links": {
26-
"_self": "https://readthedocs.org/api/v3/projects/project/builds/1/",
27-
"notifications": "https://readthedocs.org/api/v3/projects/project/builds/1/notifications/",
28-
"project": "https://readthedocs.org/api/v3/projects/project/",
29-
"version": "https://readthedocs.org/api/v3/projects/project/versions/v1.0/"
30-
},
31-
"urls": {
32-
"build": "https://readthedocs.org/projects/project/builds/1/",
33-
"project": "https://readthedocs.org/projects/project/",
34-
"version": "https://readthedocs.org/dashboard/project/version/v1.0/edit/"
35-
},
36-
"project": "project",
37-
"state": {
38-
"code": "finished",
39-
"name": "Finished"
40-
},
41-
"success": true,
42-
"version": "v1.0"
43-
},
4415
"_links": {
4516
"_self": "https://readthedocs.org/api/v3/projects/project/versions/v1.0/",
4617
"builds": "https://readthedocs.org/api/v3/projects/project/versions/v1.0/builds/",

readthedocs/api/v3/tests/test_projects.py

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,7 @@ def test_projects_detail_anonymous_user(self):
108108
},
109109
)
110110
data = {
111-
"expand": (
112-
"active_versions,"
113-
"active_versions.last_build,"
114-
"active_versions.last_build.config,"
115-
"permissions"
116-
),
111+
"expand": ("active_versions," "permissions"),
117112
}
118113
expected_response = self._get_response_dict("projects-detail")
119114
expected_response["permissions"]["admin"] = False
@@ -138,12 +133,7 @@ def test_projects_detail(self):
138133
},
139134
)
140135
data = {
141-
"expand": (
142-
"active_versions,"
143-
"active_versions.last_build,"
144-
"active_versions.last_build.config,"
145-
"permissions"
146-
),
136+
"expand": ("active_versions," "permissions"),
147137
}
148138
expected_response = self._get_response_dict("projects-detail")
149139

@@ -170,12 +160,7 @@ def test_projects_detail_other_user(self):
170160
},
171161
)
172162
data = {
173-
"expand": (
174-
"active_versions,"
175-
"active_versions.last_build,"
176-
"active_versions.last_build.config,"
177-
"permissions"
178-
),
163+
"expand": ("active_versions," "permissions"),
179164
}
180165
expected_response = self._get_response_dict("projects-detail")
181166
expected_response["permissions"]["admin"] = False
@@ -203,12 +188,7 @@ def test_own_projects_detail_privacy_levels_enabled(self):
203188
},
204189
)
205190
query_params = {
206-
"expand": (
207-
"active_versions,"
208-
"active_versions.last_build,"
209-
"active_versions.last_build.config,"
210-
"permissions"
211-
),
191+
"expand": ("active_versions," "permissions"),
212192
}
213193

214194
self.client.credentials(HTTP_AUTHORIZATION=f"Token {self.token.key}")

readthedocs/api/v3/views.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,6 @@ class ProjectsViewSetBase(
133133
filterset_class = ProjectFilter
134134
permit_list_expands = [
135135
"active_versions",
136-
"active_versions.last_build",
137-
"active_versions.last_build.config",
138136
"organization",
139137
"permissions",
140138
"teams",
@@ -356,10 +354,6 @@ class VersionsViewSet(
356354

357355
filterset_class = VersionFilter
358356
permission_classes = [ReadOnlyPermission | (IsAuthenticated & IsProjectAdmin)]
359-
permit_list_expands = [
360-
"last_build",
361-
"last_build.config",
362-
]
363357

364358
def get_serializer_class(self):
365359
"""

0 commit comments

Comments
 (0)