GraphQL packages are now optional peer dependencies rather than hard dependencies of
`@payloadcms/next`. Projects that only use the REST and Local APIs no longer install or bundle
them.
## Changes
- **Core no longer references `graphql`.** Removed three vestigial `BasePayload` members:
`schema`, `extensions` and `validationRules`. `schema` and `validationRules` were never read or
written; `extensions` was read by the Next.js and TanStack Start handlers but never assigned, so
it always fell through to the unmodified result. Their only effect was pulling `graphql` and
`graphql-http` types into the core package.
- **Lazy resolution in `@payloadcms/next`.** New `routes/graphql/importGraphQL.ts` resolves
`@payloadcms/graphql`, `graphql-http` and `graphql-playground-html` through `await import()`, so
they are no longer in the static module graph of `@payloadcms/next/routes`. A missing package is
rewritten into an actionable install message; a missing-module error for anything else is
rethrown untouched.
- **Optional peers.** The three packages moved from `dependencies` to optional
`peerDependencies` on `@payloadcms/next`, and `graphql` is marked optional on both `payload` and
`@payloadcms/next`.
- **Explicit deps where GraphQL routes ship.** Templates and examples previously inherited
`@payloadcms/graphql`, `graphql-http` and `graphql-playground-html` transitively from
`@payloadcms/next`; they now declare them directly, as does the `create-payload-app` Next.js
installer. Without this their `/api/graphql` routes would break.
- Documented the opt-in install in `docs/graphql/overview.mdx`.
## Breaking changes
`payload.schema`, `payload.extensions` and `payload.validationRules` have been removed. All three
were undocumented and never assigned by Payload. `extensions` was reachable as a GraphQL result
post-processing hook if set manually; there is no replacement.
Projects that use GraphQL and depend on it transitively through `@payloadcms/next` must now
install it explicitly:
```bash
pnpm add @payloadcms/graphql graphql graphql-http graphql-playground-html
```
## Tests
- 7 new unit tests covering the resolver, including the missing-package and
unrelated-error paths.
- Existing GraphQL integration suites exercise the lazy path end to end, since `NextRESTClient`
invokes the real `GRAPHQL_POST` handler.
GraphQL packages are now optional peer dependencies rather than hard dependencies of
@payloadcms/next. Projects that only use the REST and Local APIs no longer install or bundle them.Changes
graphql. Removed three vestigialBasePayloadmembers:schema,extensionsandvalidationRules.schemaandvalidationRuleswere never read or written;extensionswas read by the Next.js and TanStack Start handlers but never assigned, so it always fell through to the unmodified result. Their only effect was pullinggraphqlandgraphql-httptypes into the core package.@payloadcms/next. Newroutes/graphql/importGraphQL.tsresolves@payloadcms/graphql,graphql-httpandgraphql-playground-htmlthroughawait import(), so they are no longer in the static module graph of@payloadcms/next/routes. A missing package is rewritten into an actionable install message; a missing-module error for anything else is rethrown untouched.dependenciesto optionalpeerDependencieson@payloadcms/next, andgraphqlis marked optional on bothpayloadand@payloadcms/next.@payloadcms/graphql,graphql-httpandgraphql-playground-htmltransitively from@payloadcms/next; they now declare them directly, as does thecreate-payload-appNext.js installer. Without this their/api/graphqlroutes would break.docs/graphql/overview.mdx.Breaking changes
payload.schema,payload.extensionsandpayload.validationRuleshave been removed. All three were undocumented and never assigned by Payload.extensionswas reachable as a GraphQL result post-processing hook if set manually; there is no replacement.Projects that use GraphQL and depend on it transitively through
@payloadcms/nextmust now install it explicitly:Tests
NextRESTClientinvokes the realGRAPHQL_POSThandler.