Guest User

Untitled

a guest
Jan 20th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. # This is a GraphQL Schema for an API to manage movies
  2.  
  3. """Type of movie"""
  4. enum Genre{
  5. Drama
  6. Comedia
  7. SciFi
  8. Horror
  9. }
  10.  
  11. """Scalar type used to define years"""
  12. scalar Year
  13. """Scalar type used to define Url's"""
  14. scalar Url
  15.  
  16. # This interface contains common attributes for people
  17. """Interface with common fields for people"""
  18. interface Person {
  19. "Unique identifier"
  20. id:ID!
  21. "Name of person"
  22. name:String!
  23. "Is a male?"
  24. male:Boolean
  25. }
  26. """Type used to define actors"""
  27. type Actor implements Person{
  28. "Unique identifier"
  29. id:ID!
  30. "Name of actor"
  31. name:String!
  32. "Is a male?"
  33. male:Boolean
  34. "Url to profile of actor"
  35. profileUrl:Url
  36. }
  37.  
  38. """Type for characters"""
  39. type Character {
  40. "who's the actor"
  41. actor: Actor!
  42. "name of character"
  43. name:String!
  44. }
  45.  
  46. """Type used to define directors"""
  47. type Director implements Person{
  48. "Unique identifier"
  49. id:ID!
  50. "Name of actor"
  51. name:String!
  52. "Is a male?"
  53. male:Boolean
  54. }
  55. """Type with details for movies"""
  56. type Movie{
  57. "Unique identifier"
  58. id:ID!
  59. #The agument in the field gives us the chance to obtain the name of the movie in the different countries
  60. "Title of movie"
  61. title(country:String="Spain"):String!
  62. "Year when the movie was released"
  63. year:Year
  64. "Genre of the movie"
  65. genre:Genre
  66. "Director of the movie"
  67. director: Director!
  68. "Characters in the movie"
  69. characters:[Character!]!
  70. "Audience of the movie"
  71. audience:Int
  72. "Box-office of the movie"
  73. boxOffice:Float
  74. }
Add Comment
Please, Sign In to add comment