Help articles
Reference field options must be nested under the options key
Reference field options such as `filter` must be nested under the `options` key, not placed on the root of the reference type.
The reference field lets you define options for the input component. Define these options under the options key.
Sanity Studio reports `filter` is not allowed on a reference type definition - did you mean `options.filter`? when you place reference options on the root of the type instead of inside options. The same message is emitted for filterParams.
Where reference options belong
import {defineField, defineType} from 'sanity'
export default defineType({
name: 'blogPost',
type: 'document',
fields: [
defineField({
name: 'author',
type: 'reference',
to: [{type: 'person'}],
options: {
filter: 'age > 30',
},
}),
],
})