Skip to content

Commit 7b21270

Browse files
authored
docs(plugin-form-builder): add warning about GraphQL type name collis… (#12720)
### What? Add a warning to the form builder plugin docs about potential GraphQL type name collisions with custom Blocks or Collections. ### Why? To help users avoid schema errors caused by conflicting type names and guide them with resolution options.
1 parent 34fe36b commit 7b21270

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

docs/plugins/form-builder.mdx

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,31 @@ formBuilderPlugin({
470470
})
471471
```
472472

473+
### Preventing generated schema naming conflicts
474+
475+
Plugin fields can cause GraphQL type name collisions with your own blocks or collections. This results in errors like:
476+
477+
```txt
478+
Error: Schema must contain uniquely named types but contains multiple types named "Country"
479+
```
480+
481+
You can resolve this by overriding:
482+
483+
- `graphQL.singularName` in your collection config (for GraphQL schema conflicts)
484+
- `interfaceName` in your block config
485+
- `interfaceName` in the plugin field config
486+
487+
```ts
488+
// payload.config.ts
489+
formBuilderPlugin({
490+
fields: {
491+
country: {
492+
interfaceName: 'CountryFormBlock', // overrides the generated type name to avoid a conflict
493+
},
494+
},
495+
})
496+
```
497+
473498
## Email
474499

475500
This plugin relies on the [email configuration](../email/overview) defined in your Payload configuration. It will read from your config and attempt to send your emails using the credentials provided.
@@ -526,4 +551,4 @@ Below are some common troubleshooting tips. To help other developers, please con
526551

527552
![screenshot 5](https://github.com/payloadcms/plugin-form-builder/blob/main/images/screenshot-5.jpg?raw=true)
528553

529-
![screenshot 6](https://github.com/payloadcms/plugin-form-builder/blob/main/images/screenshot-6.jpg?raw=true)
554+
![screenshot 6](https://github.com/payloadcms/plugin-form-builder/blob/main/images/screenshot-6.jpg?raw=true)

0 commit comments

Comments
 (0)