GraphQL - Error: Encountered anonymous inline image

6 replies
Last updated: May 15, 2021
according to docs, this should work but it doesnt (as soon as i put in fields[]):
{
  name: 'mainImageMedium',
  title: 'HeaderBild Medium',
  type: 'image',
  fields: [
    {
      name: 'caption',
      type: 'string',
      title: 'Caption',
      options: {
        isHighlighted: true // <-- make this field easily accessible
      }
    }
  ],
},
I am getting: Error: Encountered anonymous inline image “mainImageMedium” for field/type “Asbrandpage”. To use this field with GraphQL you will need to create a top-level schema type for it. See
https://docs.sanity.io/help/schema-lift-anonymous-object-type
May 15, 2021, 11:13 AM
getting this error on graqhql deploy
May 15, 2021, 11:14 AM
Hey Marc, when you put this into your schema are you specifying any additional options or parameters?
May 15, 2021, 5:13 PM
on top level ? yes…
...

{
  name: 'body',
  title: 'Text nach Banner',
  type: 'blockContent',
},
{
  name: 'active',
  title: 'Aktiv',
  type: 'boolean',
  initialValue: true,
},

May 15, 2021, 5:14 PM
ohhh… that might be the difference… in the example the image type could be the top level….
May 15, 2021, 5:17 PM
I will try to refactor the image type into a seperate schema definition and include it in my other “master document”
May 15, 2021, 5:18 PM
i think you wanted to point me into that direction. Thanks.
May 15, 2021, 5:19 PM

Sanity.io – build remarkable experiences at scale

Sanity is a customizable solution that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.