Files
payloadcms/test/fields/collections/JSON/index.tsx
Alessio Gravili cc05937633 fix(next): admin panel fails compiling when fullySpecified is set in next config (#11531)
If `experimental.fullySpecified` is set to `true` in the next config, the Payload admin panel fails to compile, throwing the following error:

```ts
Failed to compile.

../../node_modules/.pnpm/@payloadcms+next@3.25.0-canary.46647b4_@types+react@18.3.1_graphql@16.10.0_monaco-editor@0.40_w3ro7ziou6gzev7zbe3qqrwaqe/node_modules/@payloadcms/next/dist/views/Version/RenderFieldsToDiff/fields/Select/DiffViewer/index.js
Attempted import error: 'DiffMethod' is not exported from 'react-diff-viewer-continued' (imported as 'DiffMethod').
```

The issue stems from incorrect import statements in `react-diff-viewer-continued` 4.0.4. This was fixed in `react-diff-viewer-continued` 4.0.5.

This PR also enables `fullySpecified` in our test suites, to catch these issues going forward.
2025-03-05 00:04:03 +00:00

87 lines
1.8 KiB
TypeScript

import type { CollectionConfig } from 'payload'
import { jsonFieldsSlug } from '../../slugs.js'
const JSON: CollectionConfig = {
slug: jsonFieldsSlug,
access: {
read: () => true,
},
fields: [
{
name: 'json',
type: 'json',
admin: {
maxHeight: 542,
},
jsonSchema: {
fileMatch: ['a://b/foo.json'],
schema: {
type: 'object',
properties: {
array: {
type: 'array',
items: {
type: 'object',
additionalProperties: false,
properties: {
object: {
type: 'object',
additionalProperties: false,
properties: {
array: {
type: 'array',
items: {
type: 'number',
},
},
text: {
type: 'string',
},
},
},
text: {
type: 'string',
},
},
},
},
foo: {
enum: ['bar', 'foobar'],
},
number: {
enum: [10, 5],
},
},
},
uri: 'a://b/foo.json',
},
},
{
name: 'group',
type: 'group',
fields: [
{
name: 'jsonWithinGroup',
type: 'json',
},
],
},
{
name: 'customJSON',
type: 'json',
admin: {
components: {
afterInput: ['./collections/JSON/AfterField.js#AfterField'],
},
},
label: 'Custom Json',
},
],
versions: {
maxPerDoc: 1,
},
}
export default JSON