| 1 |
# Main Schema |
| 2 |
schema { |
| 3 |
query: Query; |
| 4 |
} |
| 5 |
|
| 6 |
scalar Date; |
| 7 |
|
| 8 |
# Simple type to contain all scalar types |
| 9 |
type AllTypes { |
| 10 |
# Field Description for String |
| 11 |
testString: String; |
| 12 |
# Field Description for Int |
| 13 |
testInt: Int; |
| 14 |
# Field Description for ID |
| 15 |
testID: ID; |
| 16 |
# Field Description for Boolean |
| 17 |
testBoolean: Boolean; |
| 18 |
# Field Description for Float |
| 19 |
testFloat: Float; |
| 20 |
} |
| 21 |
|
| 22 |
interface ISearchable { |
| 23 |
searchPreview: String!; |
| 24 |
} |
| 25 |
|
| 26 |
union ProductTypes = Movie | Book; |
| 27 |
|
| 28 |
# Testing enum |
| 29 |
enum MovieGenere { |
| 30 |
ACTION |
| 31 |
COMEDY |
| 32 |
THRILLER |
| 33 |
DRAMA |
| 34 |
} |
| 35 |
|
| 36 |
# Testing Input |
| 37 |
input SearchByGenere { |
| 38 |
before: Date; |
| 39 |
after: Date; |
| 40 |
genere: MovieGenere!; |
| 41 |
} |
| 42 |
|
| 43 |
# Testing Interface |
| 44 |
type Movie implements ISearchable { |
| 45 |
id: ID!; |
| 46 |
searchPreview: String!; |
| 47 |
rentPrice: Float; |
| 48 |
publishDate: Date; |
| 49 |
genere: MovieGenere; |
| 50 |
cast: [String]; |
| 51 |
} |
| 52 |
|
| 53 |
# Testing Interface |
| 54 |
type Book implements ISearchable { |
| 55 |
id: ID!; |
| 56 |
searchPreview: String!; |
| 57 |
price: Float; |
| 58 |
publishDate: Date; |
| 59 |
authors: [String]; |
| 60 |
} |
| 61 |
|
| 62 |
type Query { |
| 63 |
testString: String; |
| 64 |
testDate; Date; |
| 65 |
allTypes: AllTypes; |
| 66 |
allProducts: [ProductTypes]; |
| 67 |
|
| 68 |
# searches only movies by genere with sophisticated argument |
| 69 |
searchMovieByGenere(searchObject: SearchByGenere!): [Movie]; |
| 70 |
|
| 71 |
# Searchs all products by text string |
| 72 |
searchProduct(text: String!): [ISearchable]; |
| 73 |
} |