Skip to content

feat: support project level custom fields#6736

Open
Zaimwa9 wants to merge 15 commits intofix/required-metadata-validationfrom
feat/support-project-level-custom-fields
Open

feat: support project level custom fields#6736
Zaimwa9 wants to merge 15 commits intofix/required-metadata-validationfrom
feat/support-project-level-custom-fields

Conversation

@Zaimwa9
Copy link
Contributor

@Zaimwa9 Zaimwa9 commented Feb 19, 2026

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

  • I have read the Contributing Guide.
  • 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.

Changes

Closes #6620

Support project scoped custom fields which could only be defined at organisation levels

  • Added project as foreign key to MetadataField
  • Replaced unique_together with conditional UniqueConstraints
  • _validate_required_metadata accepts project param
  • is_required_for fetched and included in responses directly (replacing 2 different requests made in the frontend => coming in next branch)
  • Added pagination

New endpoint

  • GET /projects/{id}/metadata/fields/ with
    • ?include_organisation to include inherited org-level fields (calculates the precedence for project in case of conflicts)
    • ?entity=feature|segment|environment to only return fields of the given identity (simplifies the creation of the identity)

⚠️
In case of conflicting name, project custom fields takes precedence and org ones are skipped

How did you test this code?

  • Tests and following PR

@Zaimwa9 Zaimwa9 requested a review from a team as a code owner February 19, 2026 15:02
@Zaimwa9 Zaimwa9 requested review from emyller and removed request for a team February 19, 2026 15:02
@vercel
Copy link

vercel bot commented Feb 19, 2026

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

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Feb 19, 2026 4:25pm
flagsmith-frontend-preview Ignored Ignored Preview Feb 19, 2026 4:25pm
flagsmith-frontend-staging Ignored Ignored Preview Feb 19, 2026 4:25pm

Request Review

@Zaimwa9 Zaimwa9 requested review from a team and gagantrivedi and removed request for emyller February 19, 2026 15:02
@github-actions github-actions bot added the api Issue related to the REST API label Feb 19, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 19, 2026

Docker builds report

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

@Zaimwa9 Zaimwa9 changed the title Feat/support project level custom fields feat: support project level custom fields Feb 19, 2026
@codecov
Copy link

codecov bot commented Feb 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (fix/required-metadata-validation@3cc20aa). Learn more about missing BASE report.

Additional details and impacted files
@@                         Coverage Diff                         @@
##             fix/required-metadata-validation    #6736   +/-   ##
===================================================================
  Coverage                                    ?   98.24%           
===================================================================
  Files                                       ?     1313           
  Lines                                       ?    48782           
  Branches                                    ?        0           
===================================================================
  Hits                                        ?    47928           
  Misses                                      ?      854           
  Partials                                    ?        0           

☔ 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 the feature New feature or request label Feb 19, 2026
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Feb 19, 2026
Comment on lines +30 to +45
migrations.AddConstraint(
model_name="metadatafield",
constraint=models.UniqueConstraint(
condition=models.Q(("project__isnull", True)),
fields=("name", "organisation"),
name="unique_org_level_metadata_field",
),
),
migrations.AddConstraint(
model_name="metadatafield",
constraint=models.UniqueConstraint(
condition=models.Q(("project__isnull", False)),
fields=("name", "organisation", "project"),
name="unique_project_level_metadata_field",
),
),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure this is compatible with Oracle. Is it a requirement ?

@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Feb 19, 2026
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.

1 participant

Comments