Skip to content

Commit f9bd6c2

Browse files
committed
WIP, added target library version section to input unions
1 parent e988337 commit f9bd6c2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

docs/advanced/input-unions.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ sidebar_label: Input Unions
55
sidebar_position: 3
66
---
77

8+
9+
810
Input unions (Spec § [3.10.1](https://spec.graphql.org/September2025/#sec-OneOf-Input-Objects)) are a variant on standard input objects such that only one of the defined fields may be used in a query. This can be helpful if you have an input object, such as search parameters, that gives multiple ways to search, but you want the user submitting a query to choose exactly one option to search by.
911

1012
By definition an input union is a standard [input object](../types/input-objects.md) (a class or a struct), all rules of standard input objects apply (i.e. field names must be unique, no use of interfaces etc.). However...
@@ -17,7 +19,6 @@ By definition an input union is a standard [input object](../types/input-objects
1719
A declaration exception will be thrown and the server will fail to start if either of these rules are violated for any declared input union.
1820
:::
1921

20-
2122
## Creating An Input Union
2223
An object can be declared as an input union in multiple ways:
2324

@@ -166,4 +167,8 @@ public class BakeryController : GraphController
166167

167168
:::info
168169
The `ValueOrDefault()` method will return a type of the fallback value, NOT of the input object property. This allows you to return non-null defaults in place of nullable values that must be passed on the input object. This should greatly reduce bloat in transferring query supplied values and reasonable fallbacks when necessary. When returning non-reference types, they must have compatibility between the nullable and non-nullable versions (e.g. `int` and `int?`)
169-
:::
170+
:::
171+
172+
173+
## Support
174+
Input Unions are supported in *GraphQL ASP.NET version 1.6* or later

0 commit comments

Comments
 (0)