Skip to content

feat: support object values in list for enum isAnyOf filtering - #1

Draft
cliedeman with Copilot wants to merge 2 commits into
mainfrom
copilot/implement-multiple-enum-values
Draft

feat: support object values in list for enum isAnyOf filtering#1
cliedeman with Copilot wants to merge 2 commits into
mainfrom
copilot/implement-multiple-enum-values

Conversation

Copilot AI commented May 21, 2026

Copy link
Copy Markdown

Summary

Implements multiple values for the enum handler by fixing MuiValueType.ParseLiteral to handle ObjectValueNode items inside a ListValueNode.

When MUI DataGrid uses isAnyOf on a singleSelect (enum) column configured with valueOptions, it sends values as option objects with label and value fields:

value: [{label: "Male", value: "MALE"}, {label: "Female", value: "FEMALE"}]
operator: "isAnyOf"

Previously this threw an ArgumentException due to an unimplemented TODO:

// TODO: If object, for option case we need to get the value from the object
throw new ArgumentException($"Expected a string node. Got: {node.GetType()}");

Changes

  • src/Hotchocolate.MuiDataGrid/Types/MuiValueType.cs: In ParseLiteral, added ObjectValueNode handling inside the ListValueNode case — extracts the value field from each option object (same as the existing single-object case). Also improved error messages to include available field names and clarify type expectations.

  • tests/Hotchocolate.MuiDataGrid.Test/MuiDataGridGraphQLTests.http.cs: Added two new tests:

    • TestHttpStaticEnumIsAnyOfWithObjectsQuery — inline GraphQL literal with enum option objects in a list
    • TestHttpVariableEnumIsAnyOfWithObjectsQuery — JSON variable with enum option objects in a list
  • Snapshots for the two new tests are created and committed.

Testing

All 80 tests pass (78 pre-existing + 2 new).

Copilot AI and others added 2 commits May 21, 2026 08:57
Handle ObjectValueNode items inside ListValueNode in MuiValueType.ParseLiteral,
enabling enum isAnyOf filtering with MUI DataGrid option objects
(e.g. [{label: 'Male', value: 'MALE'}]). Add HTTP tests for both
inline-literal and variable-based enum multi-select filtering."

Agent-Logs-Url: https://github.com/stackworx-dotnet/Hotchocolate.MuiDataGrid/sessions/768cc2b0-6691-4cc6-901a-11c61fc28602

Co-authored-by: cliedeman <3578740+cliedeman@users.noreply.github.com>
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