Skip to content

feat: Add IsEmpty property on ImmutableMetadata class#714

Merged
askpt merged 2 commits intoopen-feature:mainfrom
kylejuliandev:kylej/add-isempty-method-to-metadata
Mar 13, 2026
Merged

feat: Add IsEmpty property on ImmutableMetadata class#714
askpt merged 2 commits intoopen-feature:mainfrom
kylejuliandev:kylej/add-isempty-method-to-metadata

Conversation

@kylejuliandev
Copy link
Contributor

This PR

Adds new IsEmpty property on the ImmutableMetadata class as a convience method. Count is internal, so if developers want to to check whether the ImmutableMetadata has any items they need to use reflection (see here)

Related Issues

Fixes #693

Notes

Follow-up Tasks

How to test

Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
@kylejuliandev kylejuliandev added area: sdk This issue or pull request relates to an SDK type: feat New feature labels Mar 12, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the ImmutableMetadata class by adding a public IsEmpty property. This change addresses the need for a straightforward method to determine if a metadata instance is empty, improving API usability and developer experience by eliminating the previous reliance on reflection for this common check.

Highlights

  • New IsEmpty Property: Introduced an IsEmpty property to the ImmutableMetadata class, providing a convenient way to check if the metadata collection contains any items without requiring reflection.
Changelog
  • src/OpenFeature/Model/ImmutableMetadata.cs
    • Added IsEmpty property to check if the metadata dictionary is empty.
  • test/OpenFeature.Tests/ImmutableMetadataTest.cs
    • Added two new unit tests to verify the IsEmpty property's behavior for both empty and non-empty metadata instances.
Activity
  • No review activity or comments have been recorded yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a convenient IsEmpty property to the ImmutableMetadata class. The implementation is correct and accompanied by good test coverage. I've provided a couple of suggestions to make the code more concise and idiomatic with modern C# practices, both in the implementation and the tests.

@codecov
Copy link

codecov bot commented Mar 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.46%. Comparing base (a1778d1) to head (d1148d8).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #714   +/-   ##
=======================================
  Coverage   93.45%   93.46%           
=======================================
  Files          68       68           
  Lines        2951     2952    +1     
  Branches      350      350           
=======================================
+ Hits         2758     2759    +1     
  Misses        135      135           
  Partials       58       58           

☔ 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.

Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
@kylejuliandev kylejuliandev marked this pull request as ready for review March 12, 2026 20:11
@kylejuliandev kylejuliandev requested a review from a team as a code owner March 12, 2026 20:11
Copy link
Member

@askpt askpt left a comment

Choose a reason for hiding this comment

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

LGTM. I wonder if makes sense to expose the .Count also

@askpt askpt requested review from beeme1mr, chrfwow and toddbaert March 12, 2026 20:34
@kylejuliandev
Copy link
Contributor Author

LGTM. I wonder if makes sense to expose the .Count also

I can follow up on a new PR to expose that internal Count property 😄

@askpt askpt added this pull request to the merge queue Mar 13, 2026
Merged via the queue into open-feature:main with commit c07b173 Mar 13, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: sdk This issue or pull request relates to an SDK type: feat New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add isEmpty() functions to Metadata

3 participants