Skip to content

Conversation

@askpt
Copy link
Member

@askpt askpt commented Jul 13, 2025

Signed-off-by: André Silva [email protected]

This PR

This pull request introduces enhancements to the Value class in the OpenFeature.Model namespace, ensuring better equality handling, and updates dependencies to include Microsoft.Bcl.HashCode. The most significant changes include implementing equality comparison for Value, adding hash code generation, and updating project files to include the new dependency.

Enhancements to Value class:

  • src/OpenFeature/Model/Value.cs: The Value class now implements IEquatable<Value> and includes methods for equality comparison (Equals, ==, !=), hash code generation (GetHashCode), and internal helpers for comparing complex types like structures and lists. This ensures more robust and consistent equality checks. [1] [2]

Dependency updates:

Notes

This implementation is necessary for the comparison in the MultiProvider. See: #488 (comment)

@askpt askpt changed the title chroe: Add comparison to Value chore: Add comparison to Value Jul 13, 2025
@codecov
Copy link

codecov bot commented Jul 13, 2025

Codecov Report

Attention: Patch coverage is 90.00000% with 9 lines in your changes missing coverage. Please review.

Project coverage is 87.48%. Comparing base (2e70072) to head (d048516).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/OpenFeature/Model/Value.cs 90.00% 3 Missing and 6 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #523      +/-   ##
==========================================
+ Coverage   87.35%   87.48%   +0.12%     
==========================================
  Files          47       47              
  Lines        1827     1917      +90     
  Branches      190      216      +26     
==========================================
+ Hits         1596     1677      +81     
- Misses        188      191       +3     
- Partials       43       49       +6     

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

@askpt askpt marked this pull request as ready for review July 13, 2025 14:34
@askpt askpt requested a review from a team as a code owner July 13, 2025 14:34
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="$(MicrosoftExtensionsVersion)" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(MicrosoftExtensionsVersion)" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="$(MicrosoftExtensionsVersion)" />
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
Copy link
Member Author

Choose a reason for hiding this comment

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

Great question. It is used to generate the HashCode for the IEquatable override. Check the documentation here: https://learn.microsoft.com/en-us/dotnet/api/system.hashcode?view=net-9.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants