Skip to content

C#: rename property 'Equals' - #8134

Open
Wolfgang Knauf (WolfgangHG) wants to merge 1 commit into
microsoft:mainfrom
WolfgangHG:equals
Open

C#: rename property 'Equals'#8134
Wolfgang Knauf (WolfgangHG) wants to merge 1 commit into
microsoft:mainfrom
WolfgangHG:equals

Conversation

@WolfgangHG

Copy link
Copy Markdown
Contributor

This is attempt to resolve #8133

The NOTION.COM api contains model properties equals that result in class property Equals, which causes a warning.

This commit adds a list of reserved property names (which currently contains only Equals). The result looks like this:

    public partial class CheckboxPropertyFilterMember1 : IAdditionalDataHolder, IParsable
    {
        /// <summary>The equals property</summary>
        public bool? EqualsEscaped { get; set; }

Please review it thorougly, maybe my approach to add a class CSharpReservedPropertyNamesProvider and another call to ReplaceReservedNames in CSharpRefiner.RefineAsync could have been done better. If yes, give me feedback 😄

@WolfgangHG
Wolfgang Knauf (WolfgangHG) requested a review from a team as a code owner September 2, 2026 20:09

@baywet Vincent Biret (baywet) 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.

Thank you for the contribution

Comment thread CHANGELOG.md
### Changed

- Ruby: a model sharing its name with a sibling namespace had the disambiguation suffix applied once per reference to it rather than once, so generation failed with `The element to rename was not found available_phone_number_countryModelModelModelModel`. The reference pass was removed: `CodeType.Name` already delegates to the type definition, so references follow the rename on their own. Un-suppresses the Twilio integration and idempotency tests. [kiota-abstractions-ruby#66](https://github.com/microsoft/kiota-abstractions-ruby/issues/66)
- C#: create property "EqualsEscaped" instead of "Equals" for model properties "equals" to avoid a compiler warning [#8133](https://github.com/microsoft/kiota/issues/8133)

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.

Update your pull request and move to the unreleased section. We're in the process of releasing.

{
private readonly Lazy<HashSet<string>> _reservedNames = new(static () => new(StringComparer.OrdinalIgnoreCase)
{
"Equals" //warning "hides inherited member 'object.Equals(object?)'", https://github.com/microsoft/kiota/issues/8133

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.

Shouldn't get hash code and to string be in here in principle?

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.

[C#] Property name "Equals" causes compiler warning for NOTION.COM

2 participants