-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
import syntax in schema #6
Comments
this is a must! |
Is there potential of doing an even easier solution by just having the user supply a list of files related to the schema in the config file ie: schema.graphql type Schema {
getUser(id: Int) User
} user.graphql type User {
...
} gengql.yml ...
schema_files:
- "schema.graphql"
- "user.graphql"
... Which could then be read in and parsed/validated at the same time using the parser? This seems to be pretty easy to implement if it is a good alternative solution |
You can write bash or bat script to concatenate these files before gqlgen
W dniu pt., 7.09.2018 o 07:24 Cody Ley-Han <notifications@github.com>
napisał(a):
… Is there potential of doing an even easier solution by just having the
user supply a list of files related to the schema in the config file ie:
*schema.graphql*
type Schema {
getUser(id: Int) User
}
*user.graphql*
type User {
...
}
*gengql.yml*
...schema_files:
- "schema.graphql"
- "user.graphql"
...
Which could then be read in and parsed/validated at the same time using
the parser? This seems to be pretty easy to implement if it is a good
alternative solution
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#6 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AFXy-XBNKGZNYPOrFFzxiei6eHASPdZqks5uYgLwgaJpZM4SGAX9>
.
|
Personally, I use simple bash script for it. ./scripts/genSchema.sh #!/bin/sh
find ../schema -type f -name '*.gql' | xargs -I{} sh -c "cat {}; echo ''" > ../schema/schema_gen.graphql It simply concatenates all Then I just added
Does the job. |
Hey @rolimb, you said:
Could you clarify where exactly you've added that snippet? |
@rolimb can be simplified |
@piotrkochan, Not sure about your question. Actually I took your advise:
And that's exactly what I did. // Package graph ...
//go:generate sh ../scripts/genSchema.sh
//go:generate gorunpkg github.com/99designs/gqlgen
package graph
// Resolver ...
type Resolver struct {
Server *Server
}
// RootMutation resolver
func (r Resolver) RootMutation() RootMutationResolver {
return r.Server
}
// RootQuery resolver
func (r Resolver) RootQuery() RootQueryResolver {
return r.Server
} |
@DenisNeustroev, I'm sure it can be simplified and/or done in other million different ways. |
I mean, I haven't seen golang syntax like:
Does it really run these scripts automatically? |
@piotrkochan, I followed the instructions from Finishing touches.
in the project's root and the files got regenerated:
|
@vektah Is there any updates on this? Looking at the parser this should be possible now? I might have a go at making a PR... |
The graphql-import has capability to import one specific element and his dependencies. I think this resource is very useful.
Maybe we can reach the same capability in gqlgen.yml
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Follow the conventions in https://github.com/graphcool/graphql-import to stitch together multiple schemas.
Prereq for Schema Stitching
The text was updated successfully, but these errors were encountered: