ardatan / ardatan/graphql-import

v0.6.0 breaks import functionality (working in v0.5.2)

Open
#180 6 comments 6 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
864
Forks
53
PR merge metrics
No merged PRs in 30d

Description

I upgraded the nxplorerJS project to v0.6.0 and got the following error

```
Syntax Error: Unexpected

GraphQL request (2:1)
1:
2:
^
22 | // Create GraphQL Schema with all the pieces in place
23 | export const setupSchema = (): GraphQLSchema => {
> 24 | const schema = makeExecutableSchema({
25 | typeDefs,
26 | resolvers: resolvers,
27 | schemaDirectives: {
```

Here is the travis build reference https://travis-ci.org/ERS-HCL/nxplorerjs-microservice-starter/jobs/382177481

This appears to be related to https://github.com/prismagraphql/graphql-import/issues/45 but when I added a dummy type the wildcard imports do not get imported properly

* Code reference: https://github.com/ERS-HCL/nxplorerjs-microservice-starter
* Main schema file: https://github.com/ERS-HCL/nxplorerjs-microservice-starter/blob/master/server/graphql/schema/main.graphql
* Schema setup file: https://github.com/ERS-HCL/nxplorerjs-microservice-starter/blob/master/server/graphql/setupSchema.ts

Code snippet
```
const typeDefs = importSchema('server/graphql/schema/main.graphql');
...
export const setupSchema = (): GraphQLSchema => {
const schema = makeExecutableSchema({
typeDefs,
resolvers: resolvers,
schemaDirectives: {
date: FormattableDateDirective,
auth: AuthDirective
}
});
```

main.graphql
```
# import * from "./starwars.graphql"
# import * from "./example.graphql"
# import * from "./user.graphql"
# import * from "./movie.graphql"
# import * from "./blog.graphql"
# import * from "./schema.graphql"
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with server/graphql/schema/main.graphql and server/graphql/setupSchema.ts, then reproduce the importSchema failure against the v0.6.0 behavior described in the issue. Compare wildcard imports with v0.5.2 and inspect the linked graphql-import issue for context. Done means the listed schema imports parse successfully and setupSchema builds the executable schema without the EOF error.

Written by the indexing model from the issue text.

Assessment

Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.