Skip to content

Conversation

Zaimwa9
Copy link
Contributor

@Zaimwa9 Zaimwa9 commented Oct 7, 2025

Thanks for submitting a PR! Please check the boxes below:

  • I have added information to docs/ if required so people know about the feature!
  • I have filled in the "Changes" section below?
  • I have filled in the "How did you test this code" section below?
  • I have used a Conventional Commit title for this Pull Request

Changes

To meet Vercel requirements, we need to provide the list of MV values in order for their Flag Explorer to list them.
It is using the SDK under the hood so it is not possible to use private keys to GET the same endpoint as the platform.
Hence why the creation of an endpoint specifically for this case

  • Created a GET endpoint /api/v1/flags/{featureID}/multivariate-options/ with environment key permission level to get the list of multivariate values

Response as follows, voluntarily sending the bare minimum:

    "control_value": "test",
    "options": [
        {
            "value": 1
        },
        {
            "value": "yolotest"
        },
        {
            "value": "ortest"
        },
        {
            "value": "plop"
        }
    ]
}

Will be used as follows in vercel package (yet to be changed):

  if (flag.feature.type === 'MULTIVARIATE') {
        try {
          const mvResponse = await fetch(
            `https://api.flagsmith.com/api/v1/flags/${flag.feature.id}/multivariate-options/`,
            {
              method: 'GET',
              headers: { 'X-Environment-Key': options.environmentKey },
            },
          );
          if (mvResponse.ok) {
            const body =
              (await mvResponse.json()) as FlagsmithMultivariateApiData;
            const { control_value, options } = body;

How did you test this code?

  • Added tests
  • Locally
image

@Zaimwa9 Zaimwa9 requested a review from a team as a code owner October 7, 2025 15:02
@Zaimwa9 Zaimwa9 requested review from gagantrivedi and removed request for a team October 7, 2025 15:02
Copy link

vercel bot commented Oct 7, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
docs Ignored Ignored Preview Oct 8, 2025 8:35am
flagsmith-frontend-preview Ignored Ignored Preview Oct 8, 2025 8:35am
flagsmith-frontend-staging Ignored Ignored Preview Oct 8, 2025 8:35am

@github-actions github-actions bot added api Issue related to the REST API feature New feature or request labels Oct 7, 2025
Copy link
Contributor

github-actions bot commented Oct 7, 2025

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-api-test:pr-6134 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-e2e:pr-6134 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-6134 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-frontend:pr-6134 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-6134 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-6134 Finished ✅ Results

…Flagsmith/flagsmith into feat/create-flag-mv-endpoint-for-vercel
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Oct 7, 2025
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Oct 7, 2025
Copy link

codecov bot commented Oct 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.00%. Comparing base (57f0e97) to head (650f718).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6134   +/-   ##
=======================================
  Coverage   97.99%   98.00%           
=======================================
  Files        1278     1278           
  Lines       44927    45005   +78     
=======================================
+ Hits        44028    44106   +78     
  Misses        899      899           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Oct 8, 2025
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Oct 8, 2025
@Zaimwa9 Zaimwa9 requested a review from gagantrivedi October 8, 2025 08:46
@Zaimwa9 Zaimwa9 changed the title feat: create endpoints to get a flag multivariate options feat: create endpoint to get a flag multivariate options Oct 8, 2025
@Zaimwa9 Zaimwa9 merged commit 9c91fc3 into main Oct 9, 2025
30 checks passed
@Zaimwa9 Zaimwa9 deleted the feat/create-flag-mv-endpoint-for-vercel branch October 9, 2025 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Issue related to the REST API feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants