Skip to content

Fix flags enum input rejecting an object with every flag false - #10709

Merged
michaelstaib merged 2 commits into
mainfrom
mst/flags-enum-all-false-input
Oct 27, 2026
Merged

michaelstaib merged 2 commits into
mainfrom
mst/flags-enum-all-false-input

Conversation

@michaelstaib

Copy link
Copy Markdown
Member

With EnableFlagEnums turned on, a flags enum input where every flag is false fails with "Flags need to have at least one selection". This means a client cannot set a flags value to zero. It also means a zero value the API returns cannot be sent back, because the output shows zero as an object with every flag false.

The input now treats an explicit false as a selection, so an object with no flag set to true and at least one flag set to false becomes 0. An empty object {} and an object where every field is null still fail with the same error as before.

# before: error "Flags need to have at least one selection"
# after: the resolver receives ExpenseTypes 0
mutation {
  updateExpense(types: { isParking: false, isTolls: false }) {
    isParking
    isTolls
  }
}

@michaelstaib
michaelstaib merged commit f9ceb63 into main Oct 27, 2026
7 of 8 checks passed
@michaelstaib
michaelstaib deleted the mst/flags-enum-all-false-input branch October 27, 2026 01:40
@github-actions

Copy link
Copy Markdown
Contributor

Patch coverage

100.0% of changed lines covered (4/4)

File Covered Changed Patch %
…/Core/src/Types/Types/Interceptors/FlagEnumTypeInterceptor.cs 4 4 100.0% 🟢

Project coverage: 59.5% (317675/534260 lines)

This was referenced Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant