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

addTypeDefs crashes with argument having default enum value #221

Closed
vladar opened this issue Nov 4, 2019 · 3 comments
Closed

addTypeDefs crashes with argument having default enum value #221

vladar opened this issue Nov 4, 2019 · 3 comments

Comments

@vladar
Copy link
Contributor

vladar commented Nov 4, 2019

Steps to reproduce:

  const sc = new SchemaComposer();
  sc.addTypeDefs(`
    type Image {
      random(format: ImageFormat = JPG): String
    }
      
    enum ImageFormat {
      JPG
    }
  `);

Expected result:

Doesn't throw

Actual result

Throws:

Error: Type with name "ImageFormat" does not exists

But when deleting a default value everything works as expected

First noticed in gatsbyjs/gatsby#19210

@vladar vladar changed the title addTypeDefs crashes when creating a type with default enum value addTypeDefs crashes with argument having default enum value Nov 4, 2019
@stefanprobst
Copy link
Collaborator

Note that it also works correctly as long as the enum is defined before.

@nodkz nodkz closed this as completed in 6eb02cc Nov 4, 2019
@nodkz
Copy link
Member

nodkz commented Nov 4, 2019

For graphql-compose v7 it's fixed.

For v6 which is used by Gatsby needs to wait a little bit more.

@nodkz nodkz reopened this Nov 4, 2019
@nodkz
Copy link
Member

nodkz commented Nov 4, 2019

Fixed in graphql-compose@6.3.7 and graphql-compose@7.4.3

Please reopen the issue if the error stays.

@nodkz nodkz closed this as completed Nov 4, 2019
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

3 participants