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

Missing Schema Type #190

Closed
alvis opened this issue Jun 3, 2018 · 4 comments
Closed

Missing Schema Type #190

alvis opened this issue Jun 3, 2018 · 4 comments

Comments

@alvis
Copy link

alvis commented Jun 3, 2018

Seems like importSchema omits schema type at the moment. For example, I'd expect the parsed SDL in the following simple code contains the schema type and be idential to the source. However, it doesn't.

import { importSchema } from 'graphql-import';

const typeDefs = `
schema {
  query: Query
}

type Query {
  me: String
}
`;

it('should be the same', () => {
  expect(importSchema(typeDefs)).toEqual(typeDefs);
});

When you run jest, here is the result:

 Expected value to equal:
      "
    schema {
        query: Query
    }

    type Query {
        me: String
    }
    "
    Received:
      "type Query {
      me: String
    }
    "

This expected behaviour is hitting me badly as missing the schema type means visitSchema in grahpql-tools cannot be triggered. I've a hacky solution to my problem, but I think it is a bug which should be fixed.

@patsissons
Copy link

this is definitely a bug, the following assertion should not fail.

const sdl = 'schema { query: QueryRoot } type QueryRoot { foo: String }';
expect(print(parse(importSchema(sdl)))).toEqual(print(parse(sdl)));

@gerardolima
Copy link

gerardolima commented Jul 15, 2019

Is this repository dead or this bug wasn't considered worth solving?

@schickling, @kbrandwijk?

@ardatan
Copy link
Owner

ardatan commented Jan 1, 2020

Hi @gerardolima !
In 1.0.0 beta release, we introduced a lot of changes including schema definition support;
Could you install graphql-import@beta to try new changes? Don't forget to modify your code regarding to the migration notes in README.
https://github.com/ardatan/graphql-import#updating-from-07x

@ardatan
Copy link
Owner

ardatan commented Mar 17, 2020

Available in 1.0.0!

@ardatan ardatan closed this as completed Mar 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants