This document summarizes the schema patterns employed by popular GraphQL APIs, frameworks and service providers. The shown types maybe be incomplete and not completely correct with regard to nullability or type names; however, they should provide a general idea of the capabilities of each provider.
Where appropriate, the shown types illustrate basic features like filtering, sorting and pagination. Providers may expose additional capabilities that are not illustrated in this document.
AWS Amplify
type Query {
getPost(id: ID!): Post
}
Hasura
type Query {
post_by_pk(id: ID!) Post
}
PostGraphile
type Query {
post(id: ID!): Post
}
AWS Amplify
**Note:** Generated queries do not include any "sort" parameter. Sort order is static and determined by generated indexes.type Query {
listPosts(filter: PostFilterInput, limit: Int, nextToken: String): ModelPostConnection
}
input PostFilterInput {
id: ModelIDFilterInput
title: StringFilterInput
and: [PostFilterInput]
or: [PostFilterInput]
not: PostFilterInput
}
input StringFilterInput {
ne: String
eq: String
le: String
lt: String
ge: String
gt: String
contains: String
notContains: String
between: [String]
beginsWith: String
}
type ModelPostConnection {
items: [Post]
nextToken: String
}
Hasura
type Query {
post(
where: post_bool_exp
order_by: [post_order_by]
limit: Int
offset: Int
) [Post]
}
# Note: filtering by relations is also supported
input post_bool_exp {
title: string_bool_exp
_and: [post_bool_exp]
_or: [post_bool_exp]
_not: post_bool_exp
}
input string_bool_exp {
_neq: String
_eq: String
_lte: String
_lt: String
_gt: String
_gte: String
_in: [String]
_nin: [String]
_like: String
_nlike: String
_ilike: String
_nilike: String
_similar: String
_nsimilar: String
}
# Note: Sorting by relations is possible as well
input post_order_by {
title: order_by
}
enum order_by {
asc
asc_nulls_last
asc_nulls_first
desc
desc_nulls_first
desc_nulls_last
}
PostGraphile
**Note:** Uses Relay-compliant connectionstype Query {
allPosts(
filter: PostFilterInput
orderBy: [PostOrderBy]
first: Int
last: ID
after: ID
before: ID
): PostConnection
}
input PostFilterInput {
title: StringFilterInput
and: [PostFilterInput]
or: [PostFilterInput]
not: PostFilterInput
}
input StringFilterInput {
isNull: Boolean
distinctFrom: String
notDistinctFrom: String
equalTo: String
notEqualTo: String
lessThan: String
lessThanOrEqualTo: String
greaterThan: String
greaterThanOrEqualTo: String
in: [String]
notIn: [String]
}
enum PostOrderBy {
TITLE_ASC
TITLE_DESC
}
AWS Amplify
type Mutation {
createPost(input: CreatePostInput!): Post
}
input CreatePostInput {
title: String!
}
Hasura
type Mutation {
insert_post_one(object: post_insert_input!): Post
}
input post_insert_input {
title: String!
}
PostGraphile
type Mutation {
createPost(input: CreatePostInput!): CreatePostPayload
}
type CreatePostPayload {
post: Post
}
input CreatePostInput {
post: CreatePostPostInput!
}
input CreatePostPostInput {
title: String!
}
Hasura
type Mutation {
insert_post(objects: [post_insert_input!]!): post_mutation_response
}
type post_mutation_response {
affected_rows: Int!
returning: [Post!]!
}
input post_insert_input {
title: String!
}
❌ AWS Amplify
❌ PostGraphile
AWS Amplify
**Note:** ID is included in inputtype Mutation {
updatePost(input: UpdatePostInput!): Post
}
input UpdatePostInput {
id: ID!
title: String!
}
Hasura
type Mutation {
update_post_by_pk(
_inc: post_inc_input
_set: post_set_input
pk_columns: post_pk_columns_input!
): Post
}
input post_set_input {
title: String
}
input post_inc_input {
someIntField: Int
}
input post_pk_columns_input {
id: ID
}
PostGraphile
type Mutation {
updatePostById(input: UpdatePostInput!): UpdatePostPayload
}
type UpdatePostPayload {
post: Post
}
input UpdatePostInput {
id: ID!
patch: PostPatchInput!
}
input PostPatchInput {
title: String
}
Hasura
type Mutation {
update_post_by_pk(
_inc: post_inc_input
_set: post_set_input
# See Find Many for where input type
where: post_bool_exp
): post_mutation_response
}
type post_mutation_response {
affected_rows: Int!
returning: [Post!]!
}
input post_set_input {
title: String
}
input post_inc_input {
someIntField: Int
}
❌ AWS Amplify
❌ PostGraphile
AWS Amplify
**Note:** ID is included in inputtype Mutation {
deletePost(input: DeletePostInput!): Post
}
input DeletePostInput {
id: ID!
}
Hasura
type Mutation {
delete_post_by_pk(id: ID): Post
}
PostGraphile
type Mutation {
deletePostById(input: DeletePostInput!): DeletePostPayload
}
type DeletePostPayload {
deletedPostNodeId: ID
}
input DeletePostInput {
id: ID!
}
Hasura
type Mutation {
delete_post(
# See Find Many for where input type
where: post_bool_exp
): post_mutation_response
}
type post_mutation_response {
affected_rows: Int!
returning: [Post!]!
}
❌ AWS Amplify
❌ PostGraphile