Skip to content

Commit

Permalink
GraphQL API renamings (#6197)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmatown authored Jul 27, 2021
1 parent 686c0f1 commit 4d9f89f
Show file tree
Hide file tree
Showing 54 changed files with 406 additions and 386 deletions.
12 changes: 12 additions & 0 deletions .changeset/strange-crabs-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
'@keystone-next/keystone': major
'@keystone-next/types': major
'@keystone-next/fields-document': patch
'@keystone-next/fields': patch
---

The generated CRUD queries, and some of the input types, in the GraphQL API have been renamed.

If you have a list called `Item`, the query for multiple values, `allItems` will be renamed to `items`. The query for a single value, `Item`, will be renamed to `item`.

Also, the input type used in the `updateItems` mutation has been renamed from `ItemsUpdateInput` to `ItemUpdateArgs`.
16 changes: 8 additions & 8 deletions examples-staging/assets-cloud/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ input FileFieldInput {
ref: String
}

input PostsUpdateInput {
input PostUpdateArgs {
id: ID!
data: PostUpdateInput
}
Expand Down Expand Up @@ -227,7 +227,7 @@ input PostRelateToManyInput {
disconnectAll: Boolean
}

input AuthorsUpdateInput {
input AuthorUpdateArgs {
id: ID!
data: AuthorUpdateInput
}
Expand All @@ -254,33 +254,33 @@ type Mutation {
createPost(data: PostCreateInput): Post
createPosts(data: [PostsCreateInput]): [Post]
updatePost(id: ID!, data: PostUpdateInput): Post
updatePosts(data: [PostsUpdateInput]): [Post]
updatePosts(data: [PostUpdateArgs]): [Post]
deletePost(id: ID!): Post
deletePosts(ids: [ID!]): [Post]
createAuthor(data: AuthorCreateInput): Author
createAuthors(data: [AuthorsCreateInput]): [Author]
updateAuthor(id: ID!, data: AuthorUpdateInput): Author
updateAuthors(data: [AuthorsUpdateInput]): [Author]
updateAuthors(data: [AuthorUpdateArgs]): [Author]
deleteAuthor(id: ID!): Author
deleteAuthors(ids: [ID!]): [Author]
}

type Query {
allPosts(
posts(
where: PostWhereInput! = {}
orderBy: [PostOrderByInput!]! = []
first: Int
skip: Int! = 0
): [Post!]
Post(where: PostWhereUniqueInput!): Post
post(where: PostWhereUniqueInput!): Post
postsCount(where: PostWhereInput! = {}): Int
allAuthors(
authors(
where: AuthorWhereInput! = {}
orderBy: [AuthorOrderByInput!]! = []
first: Int
skip: Int! = 0
): [Author!]
Author(where: AuthorWhereUniqueInput!): Author
author(where: AuthorWhereUniqueInput!): Author
authorsCount(where: AuthorWhereInput! = {}): Int
keystone: KeystoneMeta!
}
Expand Down
16 changes: 8 additions & 8 deletions examples-staging/assets-local/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ The `Upload` scalar type represents a file upload.
"""
scalar Upload

input PostsUpdateInput {
input PostUpdateArgs {
id: ID!
data: PostUpdateInput
}
Expand Down Expand Up @@ -205,7 +205,7 @@ input PostRelateToManyInput {
disconnectAll: Boolean
}

input AuthorsUpdateInput {
input AuthorUpdateArgs {
id: ID!
data: AuthorUpdateInput
}
Expand All @@ -232,33 +232,33 @@ type Mutation {
createPost(data: PostCreateInput): Post
createPosts(data: [PostsCreateInput]): [Post]
updatePost(id: ID!, data: PostUpdateInput): Post
updatePosts(data: [PostsUpdateInput]): [Post]
updatePosts(data: [PostUpdateArgs]): [Post]
deletePost(id: ID!): Post
deletePosts(ids: [ID!]): [Post]
createAuthor(data: AuthorCreateInput): Author
createAuthors(data: [AuthorsCreateInput]): [Author]
updateAuthor(id: ID!, data: AuthorUpdateInput): Author
updateAuthors(data: [AuthorsUpdateInput]): [Author]
updateAuthors(data: [AuthorUpdateArgs]): [Author]
deleteAuthor(id: ID!): Author
deleteAuthors(ids: [ID!]): [Author]
}

type Query {
allPosts(
posts(
where: PostWhereInput! = {}
orderBy: [PostOrderByInput!]! = []
first: Int
skip: Int! = 0
): [Post!]
Post(where: PostWhereUniqueInput!): Post
post(where: PostWhereUniqueInput!): Post
postsCount(where: PostWhereInput! = {}): Int
allAuthors(
authors(
where: AuthorWhereInput! = {}
orderBy: [AuthorOrderByInput!]! = []
first: Int
skip: Int! = 0
): [Author!]
Author(where: AuthorWhereUniqueInput!): Author
author(where: AuthorWhereUniqueInput!): Author
authorsCount(where: AuthorWhereInput! = {}): Int
keystone: KeystoneMeta!
}
Expand Down
8 changes: 4 additions & 4 deletions examples-staging/auth/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ input UserUpdateInput {
isAdmin: Boolean
}

input UsersUpdateInput {
input UserUpdateArgs {
id: ID!
data: UserUpdateInput
}
Expand Down Expand Up @@ -90,7 +90,7 @@ type Mutation {
createUser(data: UserCreateInput): User
createUsers(data: [UsersCreateInput]): [User]
updateUser(id: ID!, data: UserUpdateInput): User
updateUsers(data: [UsersUpdateInput]): [User]
updateUsers(data: [UserUpdateArgs]): [User]
deleteUser(id: ID!): User
deleteUsers(ids: [ID!]): [User]
authenticateUserWithPassword(
Expand Down Expand Up @@ -134,13 +134,13 @@ input CreateInitialUserInput {
}

type Query {
allUsers(
users(
where: UserWhereInput! = {}
orderBy: [UserOrderByInput!]! = []
first: Int
skip: Int! = 0
): [User!]
User(where: UserWhereUniqueInput!): User
user(where: UserWhereUniqueInput!): User
usersCount(where: UserWhereInput! = {}): Int
authenticatedItem: AuthenticatedItem
keystone: KeystoneMeta!
Expand Down
24 changes: 12 additions & 12 deletions examples-staging/basic/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ input PostRelateToManyInput {
disconnectAll: Boolean
}

input UsersUpdateInput {
input UserUpdateArgs {
id: ID!
data: UserUpdateInput
}
Expand Down Expand Up @@ -245,7 +245,7 @@ input UserRelateToOneInput {
disconnectAll: Boolean
}

input PhoneNumbersUpdateInput {
input PhoneNumberUpdateArgs {
id: ID!
data: PhoneNumberUpdateInput
}
Expand Down Expand Up @@ -325,7 +325,7 @@ input PostUpdateInput {
author: UserRelateToOneInput
}

input PostsUpdateInput {
input PostUpdateArgs {
id: ID!
data: PostUpdateInput
}
Expand Down Expand Up @@ -354,19 +354,19 @@ type Mutation {
createUser(data: UserCreateInput): User
createUsers(data: [UsersCreateInput]): [User]
updateUser(id: ID!, data: UserUpdateInput): User
updateUsers(data: [UsersUpdateInput]): [User]
updateUsers(data: [UserUpdateArgs]): [User]
deleteUser(id: ID!): User
deleteUsers(ids: [ID!]): [User]
createPhoneNumber(data: PhoneNumberCreateInput): PhoneNumber
createPhoneNumbers(data: [PhoneNumbersCreateInput]): [PhoneNumber]
updatePhoneNumber(id: ID!, data: PhoneNumberUpdateInput): PhoneNumber
updatePhoneNumbers(data: [PhoneNumbersUpdateInput]): [PhoneNumber]
updatePhoneNumbers(data: [PhoneNumberUpdateArgs]): [PhoneNumber]
deletePhoneNumber(id: ID!): PhoneNumber
deletePhoneNumbers(ids: [ID!]): [PhoneNumber]
createPost(data: PostCreateInput): Post
createPosts(data: [PostsCreateInput]): [Post]
updatePost(id: ID!, data: PostUpdateInput): Post
updatePosts(data: [PostsUpdateInput]): [Post]
updatePosts(data: [PostUpdateArgs]): [Post]
deletePost(id: ID!): Post
deletePosts(ids: [ID!]): [Post]
authenticateUserWithPassword(
Expand Down Expand Up @@ -416,29 +416,29 @@ type RandomNumber {
}

type Query {
allUsers(
users(
where: UserWhereInput! = {}
orderBy: [UserOrderByInput!]! = []
first: Int
skip: Int! = 0
): [User!]
User(where: UserWhereUniqueInput!): User
user(where: UserWhereUniqueInput!): User
usersCount(where: UserWhereInput! = {}): Int
allPhoneNumbers(
phoneNumbers(
where: PhoneNumberWhereInput! = {}
orderBy: [PhoneNumberOrderByInput!]! = []
first: Int
skip: Int! = 0
): [PhoneNumber!]
PhoneNumber(where: PhoneNumberWhereUniqueInput!): PhoneNumber
phoneNumber(where: PhoneNumberWhereUniqueInput!): PhoneNumber
phoneNumbersCount(where: PhoneNumberWhereInput! = {}): Int
allPosts(
posts(
where: PostWhereInput! = {}
orderBy: [PostOrderByInput!]! = []
first: Int
skip: Int! = 0
): [Post!]
Post(where: PostWhereUniqueInput!): Post
post(where: PostWhereUniqueInput!): Post
postsCount(where: PostWhereInput! = {}): Int
authenticatedItem: AuthenticatedItem
randomNumber: RandomNumber
Expand Down
Loading

1 comment on commit 4d9f89f

@vercel
Copy link

@vercel vercel bot commented on 4d9f89f Jul 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.