Giter VIP home page Giter VIP logo

Comments (3)

eliasm307 avatar eliasm307 commented on June 24, 2024 1

@jordanl17 ah thanks, I missed that in the docs 😅

from sanity.

jordanl17 avatar jordanl17 commented on June 24, 2024

Hi eliasm307 thank you for reporting and all the details added.

We can reproduce it internally and the bug has been added to triage, we will keep this issue updated once it's fixed.

from sanity.

jordanl17 avatar jordanl17 commented on June 24, 2024

Hello,

You are facing this issue as validation: (Rule) => Rule.required() will only check for any value. Specifically, for validity of an image or file field, an asset must be present to be considered defined. Please update the validation on the mainImage as below:

import type { FieldDefinition } from "sanity";

export const MainImageField: FieldDefinition<"image"> = {
  name: "mainImage",
  title: "Image principale",
  type: "image",
  validation: (Rule) => Rule.required().assetRequired(), // specifically require field value to have an asset assigned
  fields: [
    {
      name: "alt",
      type: "string",
      title: "Texte alternatif de l'image",
      validation: (Rule) => Rule.required(), // sub-field is also required
    },
  ],
};
Screenshot 2024-06-04 at 16 26 17

See more details here

from sanity.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.