graphql-hive / graphql-hive/SOFA

REST API returning fully nested data structure

Open
#776 7 comments 7 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.1k
Forks
91
Avg merge
5h 10m
Merged PRs (30d)
1

Description

I am facing a problem concerning the `depthLimit` setting:
I implemented an API template using Apollo GraphQL: https://github.com/mxcd/api-template
There I am using sofa like so:
https://github.com/mxcd/api-template/blob/master/src/index.ts#L25
```
app.use('/api', useSofa({
basePath: '/api',
schema,
depthLimit: 1
}));
```
The GraphQL application is deployed here: https://swapi.mxcd.de/graphql
Requesting a `film` via REST (https://swapi.mxcd.de/api/film/1), I get a huge result set although the `depthLimit` is set to `1`

Is this the expected behavior? I would expect to **only** receive a `film` JSON with no additional relations resolved but links indicated via IDs

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at src/index.ts around line 25, where useSofa is configured with depthLimit: 1, then reproduce the response from the linked /api/film/1 endpoint. Compare the returned nested data with the intended depth-limit behavior; the issue is done when that behavior is confirmed and the response or documentation clearly matches the expected relation handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
api, backend-api-design
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.