Skip to content
This repository has been archived by the owner on Nov 18, 2017. It is now read-only.

Input object type #9

Merged
merged 3 commits into from
Mar 26, 2016
Merged

Conversation

igl
Copy link
Contributor

@igl igl commented Mar 24, 2016

Adds the input type definition including a defaultValue property.

input Person {
  name: String = "Hans"
  age: Int = 32
  size: Float = 1.82
  funny: Boolean = true
}

returns:

{
  type: "INPUT",
  name: "Person",
  fields: {
    name: { type: "String", defaultValue: "Hans" },
    age: { type: "Int", defaultValue: 32 },
    size: { type: "Float", defaultValue: 1.82 }
    funny: { type: "Boolean", defaultValue: true }
  }

}

Strings must use double quotes "
Floats can omit leading zeros (.5 => 0.5)
Boolean values must be lower-case

@helfer
Copy link

helfer commented Mar 25, 2016

Nice! @igl: Are you using the shorthand for building a GraphQL server?

@igl
Copy link
Contributor Author

igl commented Mar 25, 2016

@helfer Not yet ;) still in the learning phase of graphql. Building an app with vanilla graphql right now.

@helfer
Copy link

helfer commented Mar 26, 2016

@igl You may find this interesting: graphql/graphql-js#114

Although I very much like the idea of generating the parser with PEG, I wonder if it makes sense to duplicate something that graphql-js already has...

@cameronhunter cameronhunter merged commit e18c122 into cameronhunter:master Mar 26, 2016
@igl igl deleted the input-object-type branch March 27, 2016 14:51
@igl
Copy link
Contributor Author

igl commented Mar 27, 2016

Using annotation over comments might be neat.

@helfer This is also more of a learning experience for me than an attempt for a production ready lib.
And isn't competition in OS always a good thing? ;)

@helfer
Copy link

helfer commented Mar 27, 2016

@igl I think competition is great, but duplicating stuff doesn't make sense, unless you're doing it to learn something, which happens to be your goal.
I'm trying to build a tool that makes it as easy as possible to create GraphQL servers, so for my use case it doesn't really make sense. Facebook's parser for GraphQL will always implement the standard, and it has all the features I think I'll need in the foreseeable future, so I'm better off using that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants