Skip to content

Commit

Permalink
feat: add disableArrayWarning option to SlugOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Stelkooo committed Jul 16, 2024
1 parent 9dbb9f6 commit 4f567e0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/@sanity/types/src/schema/definition/type/slug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface SlugOptions {
maxLength?: number
slugify?: SlugifierFn
isUnique?: SlugIsUniqueValidator
disableArrayWarning?: boolean
}

/** @public */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function serializePath(path: Path): string {

const defaultIsUnique: SlugIsUniqueValidator = (slug, context) => {
const {getClient, document, path, type} = context
const schemaOptions = type?.options as {disableArrayWarning?: boolean} | undefined
const schemaOptions = type?.options

if (!document) {
throw new Error(`\`document\` was not provided in validation context.`)
Expand Down

0 comments on commit 4f567e0

Please sign in to comment.