geldata / geldata/gel

Support for shape fragments with query files generator

Open
#5,259 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
14.2k
Forks
450
PR merge metrics
No merged PRs in 30d

Description

Having the ability to use something like the spread fragments in GraphQL with query files would reduce a lot of duplication, as many queries often are expected to return the same data. This would especially help a lot in mapping to data transfer objects.

Let's say I have a type `User` with properties `name` and `email`, I'd like to be able to define a shape fragment something like this:

```edgeql
shape UserProps {
name,
email
}
```

And utilize it in query files as such:

```edgeql
select User {
...UserProps
}
```

This would make it easy to DRY up all queries selecting for users, and I would only have to update the shape fragment in one place whenever I need to make changes.

After having used the query files quite thourouhly since it was released this has by far been the biggest annoyance, and as the library of queries grows so does the pain of maintaining it.

Extra bonus points if interfaces for the shapes would be generated together with and used in the return types of the queries.

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.