Skip to content

Commit

Permalink
APIv3: return single_version field on Project resource (#10758)
Browse files Browse the repository at this point in the history
* APIv3: return `single_version` field on `Project` resource

For some reason we weren't returning this field in the API response. I
understand there is no reason to not do it.

I added `single_version` field in the response API so we can make some decisions
from the addons based on its value.

Required by readthedocs/addons#140

* Add field where it was missing
  • Loading branch information
humitos authored Sep 21, 2023
1 parent a847397 commit 15fddf0
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 9 deletions.
1 change: 1 addition & 0 deletions docs/user/api/v3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ Project details
},
"privacy_level": "public",
"external_builds_privacy_level": "public",
"single_version": false,
"_links": {
"_self": "/api/v3/projects/pip/",
"versions": "/api/v3/projects/pip/versions/",
Expand Down
1 change: 1 addition & 0 deletions readthedocs/api/v3/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ class Meta:
"tags",
"privacy_level",
"external_builds_privacy_level",
"single_version",
# NOTE: ``expandable_fields`` must not be included here. Otherwise,
# they will be tried to be rendered and fail
# 'active_versions',
Expand Down
3 changes: 2 additions & 1 deletion readthedocs/api/v3/tests/responses/projects-detail.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,6 @@
}
],
"privacy_level": "public",
"external_builds_privacy_level": "public"
"external_builds_privacy_level": "public",
"single_version": false
}
3 changes: 2 additions & 1 deletion readthedocs/api/v3/tests/responses/projects-list.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
"translations": "https://readthedocs.org/api/v3/projects/project/translations/"
},
"privacy_level": "public",
"external_builds_privacy_level": "public"
"external_builds_privacy_level": "public",
"single_version": false
}
]
}
3 changes: 2 additions & 1 deletion readthedocs/api/v3/tests/responses/projects-list_POST.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@
}
],
"privacy_level": "public",
"external_builds_privacy_level": "public"
"external_builds_privacy_level": "public",
"single_version": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
}
],
"privacy_level": "public",
"external_builds_privacy_level": "public"
"external_builds_privacy_level": "public",
"single_version": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
}
],
"privacy_level": "public",
"external_builds_privacy_level": "public"
"external_builds_privacy_level": "public",
"single_version": false
}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
}
],
"privacy_level": "public",
"external_builds_privacy_level": "public"
"external_builds_privacy_level": "public",
"single_version": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@
}
],
"privacy_level": "public",
"external_builds_privacy_level": "public"
"external_builds_privacy_level": "public",
"single_version": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@
}
],
"privacy_level": "public",
"external_builds_privacy_level": "public"
"external_builds_privacy_level": "public",
"single_version": false
},
"triggered": true,
"version": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
},
"users": [{ "username": "testuser" }],
"privacy_level": "public",
"external_builds_privacy_level": "public"
"external_builds_privacy_level": "public",
"single_version": false
}],
"remote_organization": {
"avatar_url": "https://avatars.githubusercontent.com/u/366329?v=4",
Expand Down
1 change: 1 addition & 0 deletions readthedocs/proxito/tests/responses/v0.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"type": "git",
"url": "https://github.com/readthedocs/project"
},
"single_version": false,
"slug": "project",
"subproject_of": null,
"tags": ["project", "tag", "test"],
Expand Down

0 comments on commit 15fddf0

Please sign in to comment.