Skip to content

Commit

Permalink
feat(validation): add array validation when using tags layout with li…
Browse files Browse the repository at this point in the history
…st in options
  • Loading branch information
hermanwikner committed Aug 18, 2022
1 parent 0ba345f commit 443a734
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/@sanity/schema/src/sanity/validation/types/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ export default (typeDef, visitorContext) => {
)
}

if (typeDef?.options?.list && typeDef?.options?.layout === 'tags') {
problems.push(
warning(
'Found array member declaration with both tags layout and a list of predefined values. If you want to display a list of predefined values, remove the tags layout from `options`.'
)
)
}

return {
...typeDef,
of: of.map(visitorContext.visit),
Expand Down

0 comments on commit 443a734

Please sign in to comment.