apache / apache/apisix

feat: support REST design pattern in degraphql plugin

Open
#10,420 3 comments 0 reactions 1 assignee Claimed by @Revolyssup View on GitHub
feature-request
Dominant language
Lua
Stars
17.1k
Forks
2.9k
Avg merge
3d 16h
Merged PRs (30d)
63

Description

### Description

The [degraphql plugin](https://apisix.apache.org/docs/apisix/next/plugins/degraphql/) description says it supports `decoding RESTful API to GraphQL`. However it doesn't fully support the REST design principal.

Consider this scenario. As a user, I would like to work with graphql upstream `https://graphqlpokemon.favware.tech/v7` with the below query, which has a variable `$ability`:

```
query ($ability: AbilitiesEnum!) {
getAbility(ability: $ability) {
key
desc
name
pokemonThatHaveThisAbility {
key
backSprite
}
}
}
```

Say the REST endpoint I would like to expose to downstream clients is `/v7/ability/{ability_name}` and the HTTP method associated would be GET.

Currently this cannot be done with the `degraphql` plugin. The plugin seems to only support sending:

1. a POST request with the variable in the body or;
2. a GET request with the variable in the URL query string

None of these conforms to the RESTful design. Users should be able to expose endpoints such as `/resource/{resource_id}/morestuff` and so on.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.