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

Merged schema without Query, Mutation and Subscription #155

Closed
Fi1osof opened this issue Aug 25, 2018 · 6 comments · Fixed by #196
Closed

Merged schema without Query, Mutation and Subscription #155

Fi1osof opened this issue Aug 25, 2018 · 6 comments · Fixed by #196
Labels
🚀enhancement New feature or request ⏳waiting for release This issue or pull request is waiting to be released

Comments

@Fi1osof
Copy link
Contributor

Fi1osof commented Aug 25, 2018

let user = `type User {
id: ID
}`;

let extended = `type User {
username: String
}`;

return  mergeTypes([user, extended], {all: true});

Result:

schema {
  query: Query
}

type User {
  id: ID
  username: String
}

Need only :

type User {
  id: ID
  username: String
}
@RichardLitt
Copy link
Contributor

Thanks @Fi1osof. I'm a bit confused what you are suggesting here; is this a bug? Are you requesting a feature? Thanks.

@Fi1osof
Copy link
Contributor Author

Fi1osof commented Aug 28, 2018

@RichardLitt , sorry, forgot type this is feature, not bug. But here schema builds with Query, Mutation and Subscription, event when them does not exists: https://github.com/okgrow/merge-graphql-schemas/blob/master/src/merge_types.js#L108-L110

Maybe this helps understand what i need:

const { parse, print } = require('graphql');
...
const parsed = parse(typesMerged);

parsed.definitions = parsed.definitions.filter(
  n => n.kind !== "SchemaDefinition" && !(
    n.kind === "ObjectTypeDefinition" && ["Query", "Mutation", "Subscription"].indexOf(n.name.value) !== -1)
  );

let schema = print(parsed);

Here schema without Query and etc., types, enums and etc only.

@RichardLitt RichardLitt added the 🚀enhancement New feature or request label Aug 29, 2018
@RichardLitt
Copy link
Contributor

Thanks for clarifying! I'm going to have one of the other maintainers chime in on this; I'm not sure I understand the problem well enough to help offer advice here, but thanks for making the question clearer.

@RichardLitt RichardLitt assigned ghost Aug 29, 2018
@Fi1osof
Copy link
Contributor Author

Fi1osof commented Aug 29, 2018

@RichardLitt it needs for https://github.com/prisma/prisma-binding
For base schema not define Query and other. Then prisma generate complete schema. When merged schema contains Query/Mutation/Subscription prisma create tables in database for them.

@kamilkisiela
Copy link
Collaborator

#196 introduces schemaDefinition option which enables that

@kamilkisiela kamilkisiela mentioned this issue Jun 25, 2019
@kamilkisiela kamilkisiela added ⏳waiting for release This issue or pull request is waiting to be released and removed ⛑️help wanted Extra attention is needed 🎓good for beginners labels Jun 25, 2019
@kamilkisiela
Copy link
Collaborator

kamilkisiela commented Jun 25, 2019

It's available now under v1.6.0-beta.2. Let us know if it works :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀enhancement New feature or request ⏳waiting for release This issue or pull request is waiting to be released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants