Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly ignore fields using ObjectTypeExtension #4034

Merged
merged 6 commits into from
Aug 10, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,19 @@ protected override void OnCreateDefinition(
Definition.AttributesAreApplied = true;
}

foreach (ObjectFieldDescriptor field in Fields)
{
if (!field.Definition.Ignore)
continue;

// if this definition is used for a type extension we need a
// binding to a field which shall be ignored. In case this is a
// definition for the type it will be ignored by the type initialization.
Definition.FieldIgnores.Add(new ObjectFieldBinding(
Copy link
Member

Choose a reason for hiding this comment

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

I have added a note why we have this binding here so that in case of a refactoring we know why this is done.

field.Definition.Name,
ObjectFieldBindingType.Field));
}

var fields = new Dictionary<NameString, ObjectFieldDefinition>();
var handledMembers = new HashSet<MemberInfo>();

Expand Down
Loading