Created
January 20, 2019 10:10
-
-
Save ivancorrales/a2b617f5ad059a00f300fc67e992d0ad to your computer and use it in GitHub Desktop.
GraphQL schema with definitions & comments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a GraphQL Schema for an API to manage movies | |
"""Type of movie""" | |
enum Genre{ | |
Drama | |
Comedia | |
SciFi | |
Horror | |
} | |
"""Scalar type used to define years""" | |
scalar Year | |
"""Scalar type used to define Url's""" | |
scalar Url | |
# This interface contains common attributes for people | |
"""Interface with common fields for people""" | |
interface Person { | |
"Unique identifier" | |
id:ID! | |
"Name of person" | |
name:String! | |
"Is a male?" | |
male:Boolean | |
} | |
"""Type used to define actors""" | |
type Actor implements Person{ | |
"Unique identifier" | |
id:ID! | |
"Name of actor" | |
name:String! | |
"Is a male?" | |
male:Boolean | |
"Url to profile of actor" | |
profileUrl:Url | |
} | |
"""Type for characters""" | |
type Character { | |
"who's the actor" | |
actor: Actor! | |
"name of character" | |
name:String! | |
} | |
"""Type used to define directors""" | |
type Director implements Person{ | |
"Unique identifier" | |
id:ID! | |
"Name of actor" | |
name:String! | |
"Is a male?" | |
male:Boolean | |
} | |
"""Type with details for movies""" | |
type Movie{ | |
"Unique identifier" | |
id:ID! | |
#The agument in the field gives us the chance to obtain the name of the movie in the different countries | |
"Title of movie" | |
title(country:String="Spain"):String! | |
"Year when the movie was released" | |
year:Year | |
"Genre of the movie" | |
genre:Genre | |
"Director of the movie" | |
director: Director! | |
"Characters in the movie" | |
characters:[Character!]! | |
"Audience of the movie" | |
audience:Int | |
"Box-office of the movie" | |
boxOffice:Float | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment