Skip to content

feat: support project level custom fields#6736

Merged
Zaimwa9 merged 29 commits intomainfrom
feat/support-project-level-custom-fields
Feb 25, 2026
Merged

feat: support project level custom fields#6736
Zaimwa9 merged 29 commits intomainfrom
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

…th/flagsmith into feat/support-project-level-custom-fields
…th/flagsmith into feat/support-project-level-custom-fields
…th/flagsmith into feat/support-project-level-custom-fields
@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.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Feb 25, 2026 8:36am
flagsmith-frontend-preview Ready Ready Preview, Comment Feb 25, 2026 8:36am
flagsmith-frontend-staging Ready Ready Preview, Comment Feb 25, 2026 8:36am

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-api:pr-6736 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-6736 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-6736 Finished ✅ Results

@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels 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
@gagantrivedi
Copy link
Member

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

Wouldn't it be less confusing to not allow conflicts?

@Zaimwa9
Copy link
Contributor Author

Zaimwa9 commented Feb 23, 2026

@gagantrivedi

Wouldn't it be less confusing to not allow conflicts?

I do remember asking the question while grooming and we agreed on allowing re-creating the custom fields at project level.
Maybe @asaphko you can give us some product-wise insights here. To summarize, in project settings, we show as read-only the organisation field. You can create the same field for your project and this one will take over. A use-case I can see is to have a global custom field that you can require or not at project level.
image

What Gagan suggests is to simply forbid and return an error if the name already exists in the organisation (be it project/org level)

@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Feb 24, 2026
gagantrivedi
gagantrivedi previously approved these changes Feb 24, 2026
Base automatically changed from fix/required-metadata-validation to main February 25, 2026 08:29
@Zaimwa9 Zaimwa9 dismissed gagantrivedi’s stale review February 25, 2026 08:29

The base branch was changed.

@Zaimwa9 Zaimwa9 requested a review from a team as a code owner February 25, 2026 08:29
@Zaimwa9 Zaimwa9 requested review from kyle-ssg and removed request for a team February 25, 2026 08:29
@Zaimwa9 Zaimwa9 merged commit 835e9cb into main Feb 25, 2026
36 of 39 checks passed
@Zaimwa9 Zaimwa9 deleted the feat/support-project-level-custom-fields branch February 25, 2026 10:48
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.

Support project-level overriding of org level custom fields

4 participants