diff --git a/apps/sanity/schema/collectionTypes/Project_Collection.tsx b/apps/sanity/schema/collectionTypes/Project_Collection.tsx index 023d2fc..768ed4c 100644 --- a/apps/sanity/schema/collectionTypes/Project_Collection.tsx +++ b/apps/sanity/schema/collectionTypes/Project_Collection.tsx @@ -71,7 +71,16 @@ export default defineType({ direction: "horizontal", layout: 'radio', }, - validation: Rule => Rule.required(), + validation: Rule => [ + Rule.required(), + Rule.custom((value, context) => { + const name = (context.parent as { name: string })?.name; + if (name && value && name.includes(value)) { + return true; + } + return 'Zweryfikuj poprawność miasta' + }).warning(), + ], }), defineField({ name: 'startDate',