olragon / graphql_api

GraphQL for Drupal 7
GNU General Public License v2.0
13 stars 3 forks source link

Taxonomy term vocabulary not working #26

Open njt1982 opened 5 years ago

njt1982 commented 5 years ago

I think the problem lies around here: https://github.com/olragon/graphql_api/blob/134df5810a244b8f50dc3ca0a9d7968faf8215be/src/Schema.php#L1448

If I do this:

query {
  taxonomy_term(tid:"27074" ) {
    tid
    name
    vocabulary {
      vid
      name
    }
  }
}

I get:

  "data": {
    "taxonomy_term": [
      {
        "tid": "27074",
        "name": "",
        "vocabulary": null
      }
    ]
  },

I think this is because vocabulary is being treated as a property on a term?

njt1982 commented 5 years ago

Hmm.. entity_get_property_info() returns vocabulary as a property on tazonomy_term...

njt1982 commented 5 years ago

With this change, the above query works:

  "data": {
    "taxonomy_term": [
      {
        "tid": "27074",
        "name": "",
        "vocabulary": {
          "vid": "5",
          "name": "[REDACTED]"
        }
      }
    ]
  },