julienvincent / modelizr

Generate GraphQL queries from models that can be mocked and normalized.
http://julienvincent.github.io/modelizr
176 stars 6 forks source link

Use existing graphql schema instead of recreating the models #10

Closed jansenignacio closed 8 years ago

jansenignacio commented 8 years ago

It would be great if you didn't have to recreate your entire graphql schema to follow Modelizr's syntax. If there was some way to hook modelizr into the existing graphql schema, it would make this library much more user-friendly.

julienvincent commented 8 years ago

I agree. It would be nice to support graphql-js's SchemaTypes - definitely something I would like to introduce in future.

julienvincent commented 8 years ago

I've been thinking more about this, and I'm doubting the necessity of this. Modelizr is a client targeted library and in my opinion it should have models that are not glued to the server-side GraphQL schemas.

@jansenignacio Could you perhaps describe a use case that this could make sense?

alexisvincent commented 8 years ago

@julienvincent can you think of a case when you wouldn't want the client to be 'glued' to the server.

julienvincent commented 8 years ago

Yes, most of the time the client does not want to / is not authorized to view all of the fields available on a schema.

alexisvincent commented 8 years ago

Authorization is a server-side concern. What is the problem with having a full type specification when you only need 80%.

jansenignacio commented 8 years ago

@julienvincent after using GraphQL a bit more, I've also come to the same conclusion as you. The use case I had thought of is not really valid.

julienvincent commented 8 years ago

@jansenignacio Thanks for your input - you might also be interested in looking at the rewrite for v1. Creating a model is now much less verbose and hopefully makes this library more user friendly.