-
-
Notifications
You must be signed in to change notification settings - Fork 798
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
Features #13
Comments
Ideally, it should be possible to replace this file: // schema.js
import {
GraphQLObjectType,
GraphQLSchema,
GraphQLInt,
GraphQLString,
GraphQLList,
} from "graphql"
import ImageType from "./image"
import ColorType from "./color"
const ContentType = new GraphQLObjectType({
name: "Content",
fields: () => ({
body: {
type: GraphQLString,
resolve: content => content.body
},
description: {
type: GraphQLString,
resolve: like => like.description
},
scripture: {
type: GraphQLString,
resolve: content => content.scripture
},
ooyalaId: {
type: GraphQLString,
resolve: content => content.ooyalaId
},
images: {
type: new GraphQLList(ImageType),
resolve: content => content.images
},
tags: {
type: new GraphQLList(GraphQLString),
resolve: content => content.tags
},
colors: {
type: new GraphQLList(ColorType),
resolve: content => content.colors
},
speakers: {
type: GraphQLString,
resolve: content => content.speakers
}
})
})
export default ContentType With this:
I feel like that would really make things feel nice. |
@helfer do you have a rough api design you would like to see for the loaders? If so, I can start working on mongo, mysql, and mssql loaders 👍 |
@jbaxleyiii I wrote some of my thoughts here #21 Basically I think the loaders should look like query builders, which will allow us to do the batching and caching automatically, without people having to write their own batching mechanism as they currently have to with DataLoader. Unfortunately I don't see a way to make the REST loaders behave in a similar fashion right now, so their API will most likely be different. We could put additional abstractions on top of that, but then we'd essentially be building an ORM, which I believe is not what we want. Although... now that I think of it, GraphQL might be exactly the right technology for writing the one ORM to rule them all!!! What I mean by that is that we could build an ORM that supports the intersection of operations provided by ORMs for different DBs, a polyglot ORM so to speak. That would mean that one 'Connector' would be enough for virtually any DB out there. My suspicion is that the set of operations that all of these ORMs let you do would be sufficient for most purposes. If performance optimizations require using database specific technologies later, It would always be possible to write resolve functions that use a custom connector on top of the DB-specific loaders we have. -- Anyway, that's just a side note, I think we don't have to worry about that for now, it's just an idea for later. |
Updated the first comment to show that the only thing currently missing is type composition. |
@helfer I love the idea around the ORM, I also think GraphQL is the perfect abstract layer to implement a powerful way to combine databases together but this is not the purpose of this topic. I write this message to have more information about the type / resolver function composition. Did you make some progress to adding this feature in the next release? |
@Aurelsicoko we've temporarily shifted focus away from graphql-tools, so I won't be working on it in the forseeable future. I still think it could be a cool project though, and I'd be happy to give feedback and help with a PR that implements better composition for types and resolvers. |
Who is we in "we've"? |
"We" as in "we the Apollo team". |
@helfer ok, that's what I was inferring, and wanted to be sure. So... I'm embarking on a new project that is using GraphQL, and I've been perusing Apollo Stack, but when I see statements like this, I get nervous. So, is there a write-up yet about where the focus is being shifted? Are you simply recommending Relay at this point? |
@jpdesigndev There's no need to be worried. In fact, the opposite is true. We're shifting focus away from graphql-tools to spend more time on Apollo Client, our alternative to Relay. Shifting focus away from graphql-tools is an Apollo-internal rebalancing of efforts to make sure we spend our time where it makes a difference. Overall, we are investing significantly more resources into Apollo than before, not less. |
@helfer Yes, I was misunderstanding. I'm conflating a resource shift away from apollo server tools with apollo client tools. Thanks for clearing that up! |
This issue doesn't seem valuable anymore IMO. Maybe we should close it? |
I looked at it yesterday and decided we should keep it open a bit longer, because I still think it would be nice if we had some sort of schema/resolver composition in graphql-tools. However, if nothing happens within the next 30 days, I think we'll close it. |
Yeah, just saying it could be reopened as an issue called "add schema/resolver composition", rather than "Features" with a giant checklist at the top. |
Shorthand and schema definition:
Documentation, Examples + Guide:
A clear story for loading, batching, caching and auth
library of loaders, starting with http, then mongo, sql etc.a good story for autha good story for cachingTracing:
measure + graph performance differences between SQL joins and multiple batched + cached graphql requests (write a Medium post about it as well)Note: Struck todos are no longer relevant to graphql-tools because they should be implemented in either apollo-server or tracer-agent.
The text was updated successfully, but these errors were encountered: