Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support GraphQL mutation as list #126

Open
raminqaf opened this issue Oct 19, 2022 · 0 comments
Open

Support GraphQL mutation as list #126

raminqaf opened this issue Oct 19, 2022 · 0 comments
Labels

Comments

@raminqaf
Copy link
Contributor

Currently, we are only supporting mutation over a single object. For example:

input ProductInput {
    name: String
    color: String
}

type Product {
    id: ID
    name: String
    color: String
}

type Mutation {
    setProduct(id: ID, product: ProductInput): Product @topic(name: "product-topic")
}

and we can do the mutation like this:

mutation {
	setProduct(id:"abc", product: {name: "test-1", color: "red"}) {
		id
	}
}

However, we need to support mutations with lists so we can ingest a list of objects over a single call:

input ProductInput {
    name: String
    color: String
}

type Product {
    id: ID
    name: String
    color: String
}

type Mutation {
    setProduct(ids: [ID], products: [ProductInput]): [Product] @topic(name: "product-topic")
}

and we can do the mutation like this:

mutation {
	setProduct(ids:["abc", "efg"], product: [{name: "test-1", color: "red"}, {name: "test-2", color: "blue"}]) {
		id
	}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

1 participant