sanity icon indicating copy to clipboard operation
sanity copied to clipboard

Schema validation incorrectly allows multiple string types

Open rexxars opened this issue 1 year ago • 0 comments

Describe the bug

See https://github.com/sanity-io/sanity/issues/3627

Apparently we do not disallow using multiple different string types in an array, which we shouldn't. This issue is about addressing this and giving a helpful error message to the user.

Marking this as both a v2 and v3 issue until we can confirm/disprove that this is an issue in both.

To Reproduce

Steps to reproduce the behavior:

  1. Make an array schema type/field with multiple string options:
{
      title: 'Content',
      name: 'content',
      type: 'array',
      of: [
        {
          title: 'Heading',
          name: 'heading',
          type: 'string',
        },
        {
          title: 'Subheading',
          name: 'subheading',
          type: 'string',
        },
        {
          title: 'Paragraph',
          name: 'paragraph',
          type: 'text',
        },
      ],
    },
  1. See the studio try to render an array that allows all the different types

Expected behavior

The studio should give a schema error disallowing it.

Screenshots image

Which versions of Sanity are you using?

Run sanity versions in the terminal and copy-paste the result here.

What operating system are you using?

Which versions of Node.js / npm are you running?

@sanity/cli                      2.30.0 (latest: 2.32.0)
@sanity/base                     2.33.0 (up to date)
@sanity/core                     2.33.0 (up to date)
@sanity/default-layout           2.33.0 (up to date)
@sanity/default-login            2.33.0 (up to date)
@sanity/desk-tool                2.33.0 (up to date)
@sanity/orderable-document-list   0.0.3 (latest: 0.0.10)
@sanity/vision                   2.33.0 (up to date)

rexxars avatar Sep 12 '22 15:09 rexxars