If I do a GraphQL query on an asset (entries field type, limit set to 1), I get an array in return. Even if I limited the asset to just 1 in the field. So my GraphQL returns:

"image": [
  { "alt": "some alt text", "src": "http://the-image.jpg" }

With GraphQL:

image {
  alt: title
  src: url

Now is it possible to return just the first object in GraphQL one way or another? If not, what function should I look into when I copy/past the existing assets field type into my own custom field type returning just the first value of the array? I couldn't find it when looking into the field types, so must be some magic method I am guessing (or not possible at all)?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.