@@ -27,9 +27,9 @@ without error. This maintains the same backwards compatibility guarantees as
2727most GraphQL clients: adding a required field is a breaking change, but adding
2828an optional field is not.
2929
30- Currently any missing optional fields will not be serialized in queries,
31- whereas optional fields that are present in the struct but set to None will be
32- sent as ` null ` .
30+ Any missing optional fields will never be serialized in queries. Optional
31+ fields that are present in the struct but set to None will be sent as ` null ` ,
32+ unless overidden by ` skip_serializing_if ` or ` @oneOf ` (see below) .
3333
3434<!-- TODO: example of the above? Better wording. -->
3535
@@ -41,7 +41,19 @@ handle this smoothly, Cynic matches rust fields up to their equivalent
4141specifying a ` rename_all = "None" ` attribute, or customised via alternative
4242` rename_all ` values or individual ` rename ` attributes on the fields.
4343
44- #### Struct Attributes
44+ ### ` @oneOf ` input objects
45+
46+ GraphQl 2025 introduced ` @oneOf ` input objects where only a single field of the
47+ input object can be provided. This is supported natively in cynic in two ways
48+
49+ 1 . A struct input object that is defined as ` @oneOf ` will automatically skip
50+ serializing any fields that are set to ` None ` . In this case it is the
51+ responsibility of the user to enusre only one field is set - as a GraphQl
52+ server will reject any requests with more than one field.
53+ 2 . An enum with one variant per field can be used instead - this will be
54+ correctly serialized as an object.
55+
56+ ### Struct Attributes
4557
4658An InputObject can be configured with several attributes on the struct itself:
4759
@@ -53,18 +65,18 @@ An InputObject can be configured with several attributes on the struct itself:
5365 a particular rule to match their GraphQL counterparts. If not provided this
5466 defaults to camelCase to be consistent with GraphQL conventions.
5567- ` schema ` tells cynic which schema to use to validate your InlineFragments.
56- The schema you provide should have been registered in your ` build.rs ` . This
68+ The schema you provide should have been registered in your ` build.rs ` . This
5769 is optional if you're using the schema that was registered as default, or if
5870 you're using ` schema_path ` instead.
5971- ` schema_path ` sets a path to the GraphQL schema. This is only required
6072 if you're using a schema that wasn't registered in ` build.rs ` .
61- - ` schema_module ` tells cynic where to find your schema module. This is
73+ - ` schema_module ` tells cynic where to find your schema module. This is
6274 optional and should only be needed if your schema module is not in scope or
6375 named ` schema ` .
6476
6577<!-- TODO: list of the rename rules, possibly pulled from codegen docs -->
6678
67- #### Field Attributes
79+ ### Field Attributes
6880
6981Each field can also have it's own attributes:
7082
0 commit comments