Skip to content

fix(dotnet): make AdditionalProperties null-safe in model Equals template - #735

Merged
SoulPancake merged 2 commits into
openfga:mainfrom
ayushpathak75:patch-1
Sep 29, 2026
Merged

SoulPancake merged 2 commits into
openfga:mainfrom
ayushpathak75:patch-1

Conversation

@ayushpathak75

@ayushpathak75 ayushpathak75 commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Description

Updates the .NET model equality template to safely check AdditionalProperties for null using object.ReferenceEquals before accessing .Count.

Related Issues

Summary by CodeRabbit

  • Bug Fixes
    • Corrected equality checks for generated models with additional properties. Models now compare as equal when they share the same property collection, and safely handle missing collections when comparing their contents.

…late

## Description
Updates the .NET model equality template to safely check `AdditionalProperties` for null using `object.ReferenceEquals` before accessing `.Count`.
## Related Issues
- openfga/dotnet-sdk#124
- openfga/dotnet-sdk#239
@ayushpathak75
ayushpathak75 requested a review from a team as a code owner September 25, 2026 11:56
@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 18f7ca3c-5c0c-4fcb-9deb-d2ad0642a3dd

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: f6db8157-bfb0-40ac-80ca-a5e36217385f

📥 Commits

Reviewing files that changed from the base of the PR and between 2a7b1df and 5f4d14a.

📒 Files selected for processing (1)
  • config/clients/dotnet/template/modelGeneric.mustache

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

The .NET model template now handles identical and null AdditionalProperties references during equality checks. For distinct non-null dictionaries, it compares entries when their counts match.

Changes

.NET model equality

Layer / File(s) Summary
AdditionalProperties equality
config/clients/dotnet/template/modelGeneric.mustache
Equality returns true when both references are identical. Otherwise, it compares entries only when both dictionaries are non-null and have equal counts.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix

Suggested reviewers: soulpancake

Merge Risk: ⚪ Minimal · up to 5f4d1

This change makes model equality safe when AdditionalProperties is null, with no newly identified merge-blocking risk.

Architecture Summary

Architecture risk: 🔵 Low · up to 5f4d1

The change affects 1 system.

Changed systems: config

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — config (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in config/clients/dotnet/template/modelGeneric.mustache: AdditionalProperties equality now returns true for identical dictionary references, including null references; otherwise it compares entries only when both dictionaries are non-null and their counts match. The previous comparison accessed both dictionaries without null checks.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: making AdditionalProperties null-safe in the .NET model Equals template.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🧪 Generate unit tests (beta)
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@SoulPancake SoulPancake left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM
Thanks a lot @ayushpathak75

@SoulPancake
SoulPancake added this pull request to the merge queue Sep 29, 2026
Merged via the queue into openfga:main with commit 71a68d0 Sep 29, 2026
18 of 20 checks passed
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.

2 participants