Skip to content

Conversation

@brianjbuck-wgu
Copy link
Contributor

Description

  • Flatten the Content Groups API v2 response to return only groups and studio_content_groups_link
  • Remove unnecessary metadata fields that were designed for Studio's internal use
  • Update tests to match the new response structure

New Response Format

{                                                                                                                                                                                            
    "groups": [                                                                                                                                                                                
      {"id": 123, "name": "Content Group A", "version": 1, "usage": []}                                                                                                                        
    ],                                                                                                                                                                                         
    "studio_content_groups_link": "/course/course-v1:org+course+run/group_configurations"                                                                                                      
  } 

Supporting information

Implements: #37973

Testing instructions

  • Manual test: GET /api/cohorts/v2/courses/{course_id}/group_configurations returns simplified response with content groups
  • Manual test: GET /api/cohorts/v2/courses/{course_id}/group_configurations returns empty groups array when no content groups exist

Deadline

None

Other information

None

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Feb 3, 2026
@openedx-webhooks
Copy link

openedx-webhooks commented Feb 3, 2026

Thanks for the pull request, @brianjbuck-wgu!

This repository is currently maintained by @openedx/wg-maintenance-openedx-platform.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@github-project-automation github-project-automation bot moved this to Needs Triage in Contributions Feb 3, 2026
@brianjbuck-wgu brianjbuck-wgu force-pushed the feature/37973-simplify-content-groups-api-response branch from 1b88077 to 0f2fd95 Compare February 3, 2026 17:57
@brianjbuck-wgu brianjbuck-wgu marked this pull request as ready for review February 3, 2026 19:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR simplifies the Content Groups API v2 response by flattening the structure and removing internal metadata fields. The response now directly returns content groups and a Studio link, rather than nesting groups within a configuration wrapper.

Changes:

  • Simplified response structure to return id, groups, and studio_content_groups_link directly
  • Removed internal metadata fields (should_show_enrollment_track, should_show_experiment_groups, context_course, etc.)
  • Updated serializer, tests, and API documentation to reflect the new response format

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
openedx/core/djangoapps/course_groups/rest_api/views.py Refactored view to build simplified response with flattened groups and Studio URL
openedx/core/djangoapps/course_groups/rest_api/tests/test_views.py Updated tests to verify new response structure with id, groups, and studio_content_groups_link
openedx/core/djangoapps/course_groups/rest_api/serializers.py Modified serializer to define new flat response structure
openedx/core/djangoapps/course_groups/rest_api/docs/content-groups-api-v2-spec.yaml Updated API spec to document simplified response schema

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@patch('lms.djangoapps.instructor.permissions.InstructorPermission.has_permission')
def test_list_auto_creates_empty_content_group_if_none_exists(self, mock_perm):
"""Verify empty content group is auto-created when none exists"""
def test_list_returns_empty_groups_when_none_exist(self, mock_perm):
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test doesn't verify the studio_content_groups_link format when no content groups exist. Add an assertion using @override_settings decorator (like in test_list_content_groups_returns_json) to verify the Studio URL is correctly constructed even when no partition exists.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@brianjbuck-wgu brianjbuck-wgu force-pushed the feature/37973-simplify-content-groups-api-response branch from 0f2fd95 to 61c7865 Compare February 3, 2026 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open-source-contribution PR author is not from Axim or 2U

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

2 participants