Code Monkey home page Code Monkey logo

Comments (6)

ecstasy2 avatar ecstasy2 commented on March 28, 2024

What would be a good way to start helping on this?

from graphql-js.

leebyron avatar leebyron commented on March 28, 2024

We're not sure yet. We'll speak with those working on GraphQL client tools at Facebook to figure out what will best support their needs and that will help us understand the direction to move in.

from graphql-js.

charypar avatar charypar commented on March 28, 2024

More about #16 (I think?), but is there any vision for parsing the schema definition language into (partial) "AST" (which you now build by hand) and providing an API to define resolve functions for individual attributes?

I have something roughly like this in mind:

import {schemaDefine} from 'graphql'

const schema = schemaDefine(`
type User {
    name: String!
    interests: [String]
}

queryType {
    user(id: ID): User
}
`);

schema.getType('User').defineFieldResolvers(() => {
    name: (user) => user.name,
    interests: (user) => user.interests.map(interest => interest.label)
});

...

There's obviously more thinking to be done around defining custom scalars, etc., but is this something that you have on the roadmap or would be interested in?

from graphql-js.

leebyron avatar leebyron commented on March 28, 2024

This isn't something on the roadmap. We haven't considered an approach like that very seriously because while it could make simple cases more terse, it could also be harder to understand and harder to extend.

Documentation, for example, is missing from this particular suggestion and a critical part of a well built GraphQL server, so we want to avoid giving tools that makes documentation harder rather than easier.

There's probably something to a partial code-generation (similar to Rails or Yeoman) that would be really valuable to reduce typing, which is one of the interesting paths that could be taken for building a parser for client-side types.

The primary desire for client-side types, at least from how I've seen GraphQL used at Facebook over the last 3 years, is for doing code-generation in our client applications when the types a GraphQL server provides need to be extended by the iOS or Android client.

from graphql-js.

leebyron avatar leebyron commented on March 28, 2024

This is now mostly covered by #74

from graphql-js.

leebyron avatar leebyron commented on March 28, 2024

Individual changes increment towards this, and the tracking task is at graphql/graphql-spec#90

from graphql-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.