GraphQLの型
Scalar型
Int
Float
JSON上ではnumberになる
String
Boolean
ID
互いに固有の値になる
JSON上ではstringになる
Enum
文字列のunion型のようなもの
.graphqlenum PhotoCategory {
SELFIE
PORTRAIT
ACTION
LANDSCAPE
GRAPHIC
}
カスタムスカラー型
これで独自の DateTime
型を定義する
field持たないんだ

numberなのかstringなのかわからないじゃん
#??別途validationを書けるっぽい
普通に使える
.graphqltype Photo {
id: ID!
created: DateTime!
}
リスト型
[]
で囲う
hsと同じ
e.g. [String]
!
の位置がややこしい
ややこいGraphQL Schema | TypeScript記法で表現するなら |
`[Int]` | `null | (int|null)[]` |
`[Int!]` | `null | int[]` |
`[Int]!` | `(int|null)[]` |
`[Int!]!` | `int[]` | ←基本これをつかうはず |
一番使うやつが一番書くのダルいというデザイン

Object型
接続
直観どおりだが

1対1
.graphqltype User {
..
}
type Photo {
id: ID!
..
postedBy: User!
}
1対多
.graphqltype User {
githubLogin: ID!
..
postedPhotos: [Photo!]!
}