How to resolve Slack thread issue in Sanity community?
I can see you're trying to share a Slack thread, but unfortunately I'm unable to access Slack links directly. Slack conversations are private and not publicly accessible, so I can't see what specific issue you're encountering.
To help you effectively, please share the relevant details from that Slack thread directly here:
- What error message or issue are you experiencing?
- What are you trying to accomplish?
- Any relevant code snippets or configuration
- Which Sanity feature or tool you're working with (Studio, GROQ queries, schema definitions, content modeling, etc.)
Once you provide those details, I'll be able to search the documentation and give you a proper solution!
In the meantime, if you're looking for community support, here are some great resources:
- Sanity Community Slack - Real-time help from the community and Sanity team
- Sanity Exchange - Community plugins, starter templates, and guides
- GitHub Discussions - Technical questions and feature discussions
- Sanity Documentation - Comprehensive guides and API references
Just paste the details of your issue here and I'll be happy to help troubleshoot!
Show original thread21 replies
this is like my whole schema
import {defineType, defineField} from 'sanity'
export default defineType({
name: 'sets',
title: 'Sets',
type: 'document',
fields: [
defineField({
name: 'setNumber',
title: 'Set Number',
description: 'यहाँ Set Number लेख्नुहोस् र यो नम्बर दोहोर हुनु हुँदैन।',
type: 'number',
validation: (Rule) => [Rule.required(), Rule.min(1)],
placeholder: 'eg: 1',
}),
defineField({
name: 'slug',
title: 'Slug',
description: 'Set Number लेखेपछि Generate बटनमा क्लिक गर्नुहोस्',
type: 'slug',
options: {
source: 'setNumber',
slugify: (input) => 'set-' + input,
},
validation: (Rule) => Rule.required(),
}),
defineField({
name: 'questions',
title: 'Questions',
type: 'array',
of: [
{
type: 'object',
name: 'set',
title: 'Set',
fields: [
defineField({
name: 'questionNumber',
title: 'Question Number',
description: 'यहाँ Question Number दिनुहोस् र नम्बर दोहोर हुनु नदिनुहोस्।',
type: 'number',
validation: (Rule) => [
Rule.required().error(
' यहाँ Question Number दिनुहोस् र नम्बर दोहोर हुनु नदिनुहोस्।'
),
Rule.min(1).error(' 1 भन्दा बढी नम्बर हुनुपर्छ'),
],
placeholder: 'eg: 1',
}),
defineField({
name: 'question',
title: 'Question ',
description: 'Question यहाँ लेख्नुहोस् ',
type: 'string',
validation: (Rule) => Rule.required().error('Question लेख्नुहोस् यहाँ'),
}),
defineField({
name: 'audio',
title: 'Audio ',
type: 'file',
}),
defineField({
name: 'options',
title: 'Options ',
type: 'array',
of: [
{
type: 'object',
name: 'answer',
title: 'Answer',
fields: [
defineField({
name: 'answerText',
title: 'Answer',
type: 'string',
validation: (Rule) => Rule.required(),
}),
defineField({
name: 'isCorrect',
title: 'सही भए यसलाई छुनु नत्र भए यसलाई नछुनु',
type: 'boolean',
initialValue: false,
}),
],
},
],
validation: (Rule) => [
Rule.custom((answers) => {
if (!Array.isArray(answers)) {
return 'जवाफहरू लेख्नको लागि "Add Item" मा क्लिक गर्नुहोस् र जवाफ लेख्नुहोस्।'
}
if (answers.length < 4) {
return `कम्तिमा ४ जवाफहरु हुनुपर्छ, तर ${answers.length} जवाफ मात्र प्रदान गरिएका छन्`
}
if (answers.length > 4) {
return `अधिकतम ४ जवाफहरु हुन सक्छन्, तर ${
answers.length
} जवाफहरु प्रदान गरिएका छन्! ${answers.length - 4} जवाफ Delete गर्नुहोस्`
}
const numCorrect = answers.filter((answer) => answer.isCorrect).length
if (numCorrect === 0) {
return 'कम्तिमा एउटा जवाफ सही हुनुपर्छ'
}
if (numCorrect > 1) {
return `केवल एउटा जवाफ सही हुन सक्छ! तर तपाईंले ${numCorrect} जवाफमा Tick लाउनु भएको छ`
}
return true
}),
],
}),
],
preview: {
select: {
number: 'questionNumber',
question: 'question',
},
prepare({number, question}) {
return {
title: `Question (${number}) - ${question ? question : 'Question लेखन भुलिनुभयो'} `,
}
},
},
},
],
validation: (Rule) =>
Rule.custom((questions) => {
if (!Array.isArray(questions)) {
return '40 ओटा प्रश्नहरु लेख्नुहोस्।'
}
if (questions.length !== 40) {
return 'Questions 40 ओटा भन्दा बढी या कम हुनु हुदैन'
}
return true
}),
}),
],
preview: {
select: {
title: 'setNumber',
},
prepare({title}) {
return {
title: `Set-${title} `,
subtitle: `By Govinda Dhakal`,
imageUrl: '../static/govinda.jpg',
}
},
},
})defineField({ name: 'audio',title: 'Audio ',
type: 'file',
accept: 'audio/*',
}),
defineField({
name: 'audio',
title: 'Audio ',
type: 'file',
options: { accept: 'audio/*' },
}),defineField({ name: 'question',title: 'Question ',
description: 'Question यहाँ लेख्नुहोस् ',
type: 'string',
validation: (Rule) => Rule.required().error('Question लेख्नुहोस् यहाँ'),
}),
defineField({
name: 'audio',
title: 'Audio ',
type: 'file',
options: {accept: 'audio/*'},
}), like if there is a text in question, hidden true to audio field and if there is a audio file selected, question field hidden
title: 'Set Number',
description: 'यहाँ Set Number लेख्नुहोस् र यो नम्बर दोहोर हुनु हुँदैन।',
type: 'number',
validation: (Rule) => [Rule.required(), Rule.min(1)],
placeholder: 'eg: 1',
}),
defineField({
name: 'slug',
title: 'Slug',
description: 'Set Number लेखेपछि Generate बटनमा क्लिक गर्नुहोस्',
type: 'slug',
options: {
source: 'setNumber',
slugify: (input) => 'set-' + input,
},
validation: (Rule) => Rule.required(),
}), can i also generate slug without even clicking on generate button, i want it hidden and it has to get auto generated when i type setNumber,
title: 'Questions',
type: 'array',
of: [
{
type: 'object',
name: 'set',
title: 'Set',
fields: [
defineField({
name: 'questionNumber',
title: 'Question Number',
description: 'यहाँ Question Number दिनुहोस् र नम्बर दोहोर हुनु नदिनुहोस्।',
type: 'number',
validation: (Rule) => [
Rule.required().error(
' यहाँ Question Number दिनुहोस् र नम्बर दोहोर हुनु नदिनुहोस्।'
),
Rule.min(1).error(' 1 भन्दा बढी नम्बर हुनुपर्छ'),
],
placeholder: 'eg: 1',
}), can i make the question number auto incremented
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.