Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tsukhu opened this issue May 24, 2018 · 6 comments
Open

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

tsukhu opened this issue May 24, 2018 · 6 comments

Comments

@tsukhu
Copy link

tsukhu commented May 24, 2018

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

Syntax Error: Unexpected <EOF>
    
    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 #45 but when I added a dummy type the wildcard imports do not get imported properly

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"
@czystyl
Copy link

czystyl commented May 28, 2018

I can confirm that breaks import * from file after upgrade from 0.52 to 0.6.0

@jeromemacias
Copy link

# import Query.*, Mutation.*, * from "./starwars.graphql" works for me after upgrading from 0.4.5 to 0.6.0

@alvis
Copy link

alvis commented Jun 17, 2018

🤔 import * from file works fine to me with 0.6.

@tsukhu & @czystyl: could you prepare a minimal example?

@tsukhu
Copy link
Author

tsukhu commented Jun 17, 2018

@alvis Given that different people are having different results, this may be some specific scenario which is not working. I will try to do to create a separate sample. But if you want to look at it immediately you can check

https://github.com/ERS-HCL/nxplorerjs-microservice-starter. Once you upgrade to graphql-imports to 0.6.0 and the imports stop working there after. I had upgraded it to 0.6.0 from 0.5.2 but the build broke, hence I reverted it back.

@tsukhu
Copy link
Author

tsukhu commented Jun 18, 2018

OK .. I have debugged the issue and was able to fix the build (using 0.6.0) with the following changes

With v0.6.0 the standard schema types of Query , Mutation and Subscription MUST be provided with the root field types of Query.* , Mutation.* and Subscription.* otherwise we get a runtime error of 'EOF'

The earlier version was allowing using the wild cards only for these types as well. I guess this is also fine , but we need to have a note in the README to mention that for people upgrading from earlier versions

image

tsukhu/nxplorerjs-microservice-starter#124
With this change the travis build issue is now resolved for me. https://travis-ci.org/ERS-HCL/nxplorerjs-microservice-starter/builds/393489075

@alvis
Copy link

alvis commented Jun 18, 2018

So it is related to #176, which was merged since 0.5.3.

To be fair, the change is mentioned as tiny words in https://github.com/prismagraphql/graphql-import/releases#0.5.3, but @tsukhu is right that it's a breaking change and it should be properly documented.

ping @timsuchanek & @schickling

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants