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

Features #13

Closed
5 of 6 tasks
helfer opened this issue Apr 7, 2016 · 15 comments
Closed
5 of 6 tasks

Features #13

helfer opened this issue Apr 7, 2016 · 15 comments

Comments

@helfer
Copy link
Contributor

helfer commented Apr 7, 2016

Shorthand and schema definition:

  • type / resolve function composition

Documentation, Examples + Guide:

  • better documentation (let documentation drive devlopment sometimes)
  • a cookbook with a few examples (put on guide page?)
  • a full tutorial (put on guide page?)

A clear story for loading, batching, caching and auth

  • library of loaders, starting with http, then mongo, sql etc.
  • instructions for writing loaders/ connectors (see connectors.md)
  • a good story for auth
  • a good story for caching

Tracing:

  • basic error and performance logging (check out resolver context, or consider PR to graphql-js)
  • 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.

@stubailo
Copy link
Contributor

stubailo commented Apr 7, 2016

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:

#js import Image from './image'
#js import Color from './color'

type Content {
  body: String
  description: String
  scripture: String
  ooyalaId: String
  images: [Image]
  tags: [String]
  colors: [Color]
  speakers: String
}

I feel like that would really make things feel nice.

@jbaxleyiii
Copy link

@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 👍

@helfer
Copy link
Contributor Author

helfer commented Apr 10, 2016

@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.

@helfer
Copy link
Contributor Author

helfer commented Jun 13, 2016

Updated the first comment to show that the only thing currently missing is type composition.

@Aurelsicoko
Copy link

@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?

@helfer
Copy link
Contributor Author

helfer commented Jul 26, 2016

@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.

@paynecodes
Copy link

@helfer

we've temporarily shifted focus away from graphql-tools

Who is we in "we've"?

@helfer
Copy link
Contributor Author

helfer commented Jul 30, 2016

"We" as in "we the Apollo team".

@paynecodes
Copy link

@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?

@helfer
Copy link
Contributor Author

helfer commented Jul 30, 2016

@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.

@paynecodes
Copy link

@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!

@stubailo
Copy link
Contributor

This issue doesn't seem valuable anymore IMO. Maybe we should close it?

@helfer
Copy link
Contributor Author

helfer commented Aug 29, 2016

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.

@stubailo
Copy link
Contributor

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.

@helfer
Copy link
Contributor Author

helfer commented Aug 29, 2016

#116

@helfer helfer closed this as completed Aug 29, 2016
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

5 participants