GraphQL Shorthand Parser
Parse GraphQL shorthand notation into a JSON object that can be used to auto-generate schema files.
Shorthand notation
// One of the films in the Star Wars Trilogy
enum Episode {
NEWHOPE
EMPIRE
JEDI
}
// A character in the Star Wars Trilogy
interface Character {
id: String!
name: String
friends: [Character]
appearsIn: [Episode]
}
// A humanoid creature in the Star Wars universe
type Human : Character {
id: String!
name: String
friends: [Character]
appearsIn: [Episode]
homePlanet: String
}
// A mechanical creature in the Star Wars universe
type Droid : Character {
id: String!
name: String
friends: [Character]
appearsIn: [Episode]
primaryFunction: String
}
type Query {
hero(episode: Episode): Character
human(id: String!): Human
droid(id: String!): Droid
}
Parsed notation to JSON