Describe the Bug
Since PR #15675 (fix(plugin-mcp): use inline block schemas in JSON output), the generate:types command inlines all block type definitions at every usage site instead of referencing the named interfaceName interfaces.
Previously, when a block had an interfaceName set, the generated types would reference that interface:
// Before (3.75): compact references
blocks?: (CmsSectionProps | CmsTripSectionProps | CmsAlertSectionProps | ...)[] | null;
imageSlider?: CmsImageSliderProps[] | null;
Now, the full block schema is inlined everywhere:
// After (3.78): every block is fully inlined
blocks?: ({
title?: string | null;
richText?: { root: { type: string; children: { ... }[]; ... } } | null;
blocks?: (...)[] | null;
blockType: 'cmsSection';
} | {
title?: string | null;
items: { ... }[];
blockType: 'cmsSectionList';
} | ...)[] | null;
The named interfaces (e.g. CmsSectionProps) are still generated in the file, but they are no longer referenced inside collection/global types. This causes massive duplication.
Impact on our project:
payload-types.ts grew from 5,657 lines to 7,525 lines (+33%)
- Diff: +2,788 / -920 lines
blockType occurrences went from 42 to 126 (3x), as every block definition is duplicated at every usage site
The root cause is in configToJSONSchema.ts where $ref references were replaced with inline schemas to fix MCP compatibility (#15399). However, this also affects generate:types which doesn't need inline schemas.
Suggestion: The $ref → inline change could be scoped to MCP JSON Schema output only, while keeping $ref references for TypeScript type generation.
Link to the code that reproduces this issue
https://github.com/payloadcms/payload/pull/15675/files#diff-e31c3f38e2d3b4e4db3c8bf8e3edaa35
The change in packages/payload/src/utilities/configToJSONSchema.ts (lines 327-368) replaces $ref with inline schemas unconditionally. Any project using blocks with interfaceName will reproduce this by running generate:types on 3.76+.
Reproduction Steps
- Create a Payload project with multiple blocks that use
interfaceName
- Run
pnpm payload generate:types on Payload 3.75 — observe compact type references
- Upgrade to Payload 3.78
- Run
pnpm payload generate:types again — observe all block types are now inlined at every usage site
- Compare the two
payload-types.ts files
Which area(s) are affected?
area: core, plugin: mcp
Environment Info
- Payload: 3.78.0
- Node.js: v22
- Next.js: 15
Describe the Bug
Since PR #15675 (
fix(plugin-mcp): use inline block schemas in JSON output), thegenerate:typescommand inlines all block type definitions at every usage site instead of referencing the namedinterfaceNameinterfaces.Previously, when a block had an
interfaceNameset, the generated types would reference that interface:Now, the full block schema is inlined everywhere:
The named interfaces (e.g.
CmsSectionProps) are still generated in the file, but they are no longer referenced inside collection/global types. This causes massive duplication.Impact on our project:
payload-types.tsgrew from 5,657 lines to 7,525 lines (+33%)blockTypeoccurrences went from 42 to 126 (3x), as every block definition is duplicated at every usage siteThe root cause is in
configToJSONSchema.tswhere$refreferences were replaced with inline schemas to fix MCP compatibility (#15399). However, this also affectsgenerate:typeswhich doesn't need inline schemas.Suggestion: The
$ref→ inline change could be scoped to MCP JSON Schema output only, while keeping$refreferences for TypeScript type generation.Link to the code that reproduces this issue
https://github.com/payloadcms/payload/pull/15675/files#diff-e31c3f38e2d3b4e4db3c8bf8e3edaa35
The change in
packages/payload/src/utilities/configToJSONSchema.ts(lines 327-368) replaces$refwith inline schemas unconditionally. Any project using blocks withinterfaceNamewill reproduce this by runninggenerate:typeson 3.76+.Reproduction Steps
interfaceNamepnpm payload generate:typeson Payload 3.75 — observe compact type referencespnpm payload generate:typesagain — observe all block types are now inlined at every usage sitepayload-types.tsfilesWhich area(s) are affected?
area: core, plugin: mcp
Environment Info