ardatan / ardatan/graphql-import
Proposal: Automatic imports
- Dominant language
- No language data
- Stars
- 864
- Forks
- 53
- PR merge metrics
- No merged PRs in 30d
Description
When using `graphql-import` together with a Prisma Service, a common situation that a developer finds herself in is copying over type names.
This happens when you just want to "forward" the underlying service types to the resulting application schema.
While the current explicit nature of `graphql-import` provides good readability and maintainability, it requires in certain cases a lot of boilerplate code.
To make it possible for developers to have quicker iterations on schemas, we should introduce an automatic import mechanism.
That means, that any type used in the resulting schema, that is not defined, will be searched in specified source files.
The API could look like this:
```ts
const typeDefs = importSchema('schema.graphql', ['./generated/source.graphql'])
```
`schema.graphql`
```graphql
type A {
# test 1
first: String
second: Float
b: B
}
```
`./generated/source.graphql`
```graphql
type B {
hello: String!
}
```
Anyone interested working on this, please answer in this issue or join our public Graphcool slack!
Contributor guide
No contributing guide indexed for this repository
Research direction
The issue names importSchema, schema.graphql, and ./generated/source.graphql. Start by tracing importSchema’s current explicit-import behavior, then define and test automatic lookup of undefined types from the supplied source files. Done means the shown A/B schema resolves without copying B, with tests covering the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100