正常的graphql查询导致错误 [英] normal graphql queries causing errors

查看:135
本文介绍了正常的graphql查询导致错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经搜索了一段时间,并从SO社区获得了很多帮助.但是,似乎我的项目的设置不允许诸如排序,限制,过滤器之类的常规查询.

I have been searching around for a while and been getting a lot of help from the SO community. But, it seems that the setup of my project isn't allowing normal queries such as sort, limit, filter, or others.

我正在查询自定义的中间件/drupal网站.

I am querying a custom middleware/drupal site.

引发错误的示例:

{
  umdHub(limit: 5) {
    articles {
      data {
        id
        title
        subtitle
        body
        summary
      }
    }
  }
}

{
  umdHub(
    sort: {
      fields: [authorship_date___time]
      order: ASC
    }
  ) {
    articles {
      data {
        id
        title
        subtitle
        body
        summary
        authorship_date {
          formatted_short
          unix
          unix_int
          formatted_long
          formatted_short
          time
        }
      }
    }
  }
}

http://localhost:8000/___ graphql 中的所有返回错误,例如:

All return errors in http://localhost:8000/___graphql like:

{
  "errors": [
    {
      "message": "Unknown argument \"limit\" on field \"umdHub\" of type \"Query\".",
      "locations": [
        {
          "line": 2,
          "column": 10
        }
      ]
    }
  ]
}

我该如何解决这些问题?

How can I resolve these issues?

推荐答案

原来是这样做的方法:

{
  umdHub {
    articles (page: { limit: 5 }) {
      data {
        id
        title
        subtitle
        body
        summary
        hero_image {
          url_1200_630
        }
        authorship_date {
          formatted_short
          unix
          unix_int
          formatted_long
          formatted_short
          time
        }
        slug
      }
    }
  }
}

这篇关于正常的graphql查询导致错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆