the0938

Example Of GraphQL Schema

Dec 23rd, 2021 (edited)
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.17 KB | None | 0 0
  1. """
  2. Represents the data model in the system.
  3. """
  4. type Book {
  5. """
  6. Model ID. It is important that the field containing the model ID has a
  7. uniform name (as opposed to `rdfSubject`, as we have in the `Node` model now).
  8. """
  9. id: ID!
  10.  
  11. """
  12. The string field.
  13. """
  14. title: String!
  15.  
  16. """
  17. The date time field.
  18. """
  19. createdAt: DateTime!
  20. }
  21.  
  22. """
  23. Represents the collection of rules for filtering the list of models. All rules
  24. in this collection will be applied via logical AND.
  25.  
  26. The rules within this collection can be divided into groups. Each of the groups
  27. refers to a specific property of the data model. The set of rules within a
  28. group is determined by property type.
  29. """
  30. input BookFilters {
  31. """
  32. The identifier is strictly equal to the specified value. This is the only
  33. rule for a field of type ID.
  34. """
  35. id: ID
  36.  
  37. """
  38. The string is strictly equal to the specified value.
  39. """
  40. title: String
  41.  
  42. """
  43. The string starts with the specified value.
  44. """
  45. titleStartsWith: String
  46.  
  47. """
  48. The string ends with the specified value.
  49. """
  50. titleEndsWith: String
  51.  
  52. """
  53. The string contains the specified value.
  54. """
  55. titleContains: String
  56.  
  57. """
  58. The time is strictly equal to the specified value.
  59. """
  60. createdAt: DateTime
  61.  
  62. """
  63. The time is greater than or equal to the specified value.
  64. """
  65. createdAtGreaterThanOrEqual: DateTime
  66.  
  67. """
  68. The time is greater than the specified value.
  69. """
  70. createdAtGreaterThan: DateTime
  71.  
  72. """
  73. The time is less than or equal to the specified value.
  74. """
  75. createdAtLessThanOrEqual: DateTime
  76.  
  77. """
  78. The time is less than the specified value.
  79. """
  80. createdAtLessThan: DateTime
  81. }
  82.  
  83. """
  84. An enumeration of the model properties by which sorting is available.
  85. """
  86. enum BookSortingField {
  87. ID
  88. TITLE
  89. CREATED_AT
  90. UPDATED_AT
  91. }
  92.  
  93. """
  94. Represents the direction of the sort.
  95. """
  96. enum BookSortingOrder {
  97. DESC
  98. ASC
  99. }
  100.  
  101. """
  102. Describes the sorting rule for the list of models.
  103. """
  104. input BookSorting {
  105. """
  106. The model field by which the list should be sorted.
  107. """
  108. field: BookSortingField!
  109.  
  110. """
  111. The direction of the sort.
  112. """
  113. order: BookSortingOrder!
  114. }
  115.  
  116. """
  117. Represents a paging rule.
  118. """
  119. input BookSlicing {
  120. """
  121. Page number (numbering starts from zero).
  122. """
  123. page: Integer!
  124.  
  125. """
  126. The maximum number of items per page.
  127. """
  128. size: Integer!
  129. }
  130.  
  131. """
  132. Represents the options for getting the list of models.
  133. """
  134. input BookOptions {
  135. """
  136. List of rule collections for filtering the list. If the rules for filtering
  137. are applied through a logical AND within a separate collection, then a
  138. logical OR is used in this list of collections (that is
  139. `BookFilersA OR BookFiltersB OR BookFiltersC`).
  140. """
  141. filters: [BookFilters!]
  142.  
  143. """
  144. A list of collections of filtering rules that is used to exclude models
  145. from the list. Collections of rules will be also applied via logical OR.
  146. """
  147. exclude: [BookFilters!]
  148.  
  149. """
  150. List of rules for sorting the list of models.
  151. """
  152. sorting: [BookSorting!]
  153.  
  154. """
  155. List pagination rules.
  156. """
  157. slicing: BookSlicing!
  158. }
  159.  
  160. """
  161. Represents a list of models.
  162. """
  163. type BookList {
  164. """
  165. The total number of models that match the filtering conditions.
  166. """
  167. count: Int!
  168.  
  169. """
  170. List of models to be displayed on the described page.
  171. """
  172. items: [Book!]
  173. }
  174.  
  175. extend type Query {
  176. """
  177. Returns the number of models in the list without getting the list itself.
  178. """
  179. booksCount(bookOptions: BookOptions!): Int!
  180.  
  181. """
  182. Returns a list of models.
  183. """
  184. books(bookOptions: BookOptions!): BookList!
  185.  
  186. """
  187. Returns the first model from the list. If the list is empty, it returns
  188. `null`.
  189. """
  190. book(bookOptions: BookOptions!): Book
  191. }
  192.  
  193. input CreateBookOptions {
  194. title: String!
  195. }
  196.  
  197. input UpdateBookOptions {
  198. id: ID!
  199. title: String
  200. }
  201.  
  202. extend type Mutation {
  203. createBooks(options: [CreateBookOptions!]): [Book!]
  204. updateBooks(options: [UpdateBookOptions!]): [Book!]
  205. deleteBooks(ids: [ID!]): void
  206. createBook(options: CreateBookOptions!): Book!
  207. updateBook(options: UpdateBookOptions!): Book!
  208. deleteBook(id: ID!): void
  209. }
  210.  
Add Comment
Please, Sign In to add comment