Skip to content

Commit 676caa4

Browse files
committed
Add to usage
1 parent a506bfe commit 676caa4

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,3 +187,20 @@ import { schema as sourceSchema } from "./my-schema";
187187
188188
export const schema = semanticToStrict(sourceSchema);
189189
```
190+
191+
## Advanced usage
192+
193+
If you just want to convert a single `GraphQLFieldConfig` you can use the
194+
`convertFieldConfig` method, passing the field config and `true` to convert
195+
semantic non-null positions to strict non-nulls, or `false` if you want to
196+
convert to nullable:
197+
198+
```ts
199+
const strictFieldConfig = convertFieldConfig(fieldConfig, true);
200+
const nullableFieldConfig = convertFieldConfig(fieldConfig, false);
201+
```
202+
203+
> [!NOTE]
204+
>
205+
> This method assumes that the fieldConfig has come from parsing an SDL string,
206+
> and thus has an `astNode` that includes a `@semanticNonNull` directive.

0 commit comments

Comments
 (0)