-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Hey,
I don't know if it's innapropriate to write all my thoughts as an issue here. After your messages on Discord I really though it was cool that someone comes with an alternative to graphql ppx. After six months of using GraphQL ppx on our project, I have tons of ideas I would like for an automatic parser / serializer between reason types and a graphql schema.
So I thought to start something here as a discussion thread. If you don't like the idea you can close it of course.
My main issue with the state we have with graphql ppx is that we have too much things generated. As we tend to need these types in components, it can be really confusing. You said that if you were to do a PPX, you would probably have to rewrite GraphQL PPX from scratch. I think it would be huge for the Reason community. And I think we would be several people to help you if you started this kind of project.
Let say we have this kind of schema described on the server:
interface FeedItem {
id: String!
}
type ImageFeedItem extends FeedItem {
id: String!
imageUrl: String!
}
type TextFeedItem extends FeedItem {
id: String!
text: String!
}
type Query {
hero(episode: Episode): Character
droid(id: ID!): Droid
}I was thinking that we could to what genType is doing to map types on something external:
[@graphqlType "ImageFeedItem"]
type imageFeedItem = {
id: string,
imageUrl: string
};
[@graphqlType "TextFeedItem"]
type imageFeedItem = {
id: string,
imageUrl: string
};
[@graphqlType "FeedItem"]
type FeedItem = [`ImageFeedItem(imageFeedItem) | `TextFeedItem(textFeedItem)];So if we're parsing something from a query it would try to find what has been registered with these decorators.
Anyway, I don't know if it makes sense for you. I feel that graphql PPX is less and less maintained and we came in a situation that it's really hard to understand it. Maybe if the type creation was explicit and chosen by the developer it would be easier? I don't know.