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

How to multiple schema.json #130

Closed
spyalert01 opened this issue Aug 20, 2015 · 7 comments
Closed

How to multiple schema.json #130

spyalert01 opened this issue Aug 20, 2015 · 7 comments
Assignees

Comments

@spyalert01
Copy link

If we are building a bigger application where we have several module, we may be defining a few schema, and hence has multiple schema.json files.

How can we make sure all these schemas are properly loaded?

@yuzhi
Copy link
Contributor

yuzhi commented Aug 20, 2015

Can you elaborate more on why you need multiple schemas? GraphQL is designed to support multiple backends within the same schema. Unfortunately, Relay currently does not support multiple schemas in one application. However, it maybe possible in the future as we support data from multiple sources (see #114)

@spyalert01
Copy link
Author

When dealing with bigger application, we may need to group schema based on module requirement, the schema.js file may be big and messy when handle bigger application if we can't group it.

it will make thing hard to maintain as well.

Just like when we are doing MVC, we can have many M.

@josephsavona
Copy link
Contributor

It's natural to split your schema definition into multiple files. However, you'll still have one file that imports all these type definitions and defines the root and mutation types.

@spyalert01
Copy link
Author

Wouldn't it take too much memory / space, if we keep importing those schema that we don't need at certain point of time?

@steveluscher
Copy link
Contributor

It won't! You see, from the perspective of the client code, the schema.json is only used to compile Relay.QL; expressions. If you make no mention of one part of your schema in a Relay.QL expression, then no extra bytes will be compiled into your client code.

On the server side, a larger schema will take up more memory on your server, but as compared to other parts of your app, you should be able to let that schema file grow as large as you like without consequences.

We recommend having one schema that describes your entire data universe. Relay will use only the parts of that query it needs to compile client code, and will generate requests to your /graphql endpoint that query only those parts of the schema necessary to resolve data for your running app.

@steveluscher steveluscher self-assigned this Aug 20, 2015
@spyalert01
Copy link
Author

Is React Relay suitable to build medium to large size application using React+Relay?
Example a Mini ERP System or a Retail Chain Management System, that involve End to End process of a business?
I used to do this in PHP.

@steveluscher
Copy link
Contributor

Relay is in use in Facebook's Groups and Mobile Ads Manager apps, as well as a number of products currently under development. It's working well for us, and we hope that it works just as well for you!

If you have any more questions about using a GraphQL schema with Relay, feel free to reopen this issue, or open a new one on a new topic.

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