aboutsummaryrefslogtreecommitdiffstats
path: root/graphql/schema
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2019-06-16 21:29:49 +0200
committerMichael Muré <batolettre@gmail.com>2019-06-16 21:29:49 +0200
commitb2f8572c4493205535558fb9320689aaf4774dc1 (patch)
tree021ed8eef1bb57c73ca595c3e79706cf215d6eee /graphql/schema
parent08c0e18ade5241d124fc8a3424b7612174e82cef (diff)
downloadgit-bug-b2f8572c4493205535558fb9320689aaf4774dc1.tar.gz
graphql: change mutations to respect the Relay specification
https://facebook.github.io/relay/graphql/mutations.htm This specification also allow to expose a mutationId for fire and forget, as well as the created operation.
Diffstat (limited to 'graphql/schema')
-rw-r--r--graphql/schema/mutations.graphql170
-rw-r--r--graphql/schema/root.graphql29
2 files changed, 189 insertions, 10 deletions
diff --git a/graphql/schema/mutations.graphql b/graphql/schema/mutations.graphql
new file mode 100644
index 00000000..3eeeae6a
--- /dev/null
+++ b/graphql/schema/mutations.graphql
@@ -0,0 +1,170 @@
+input NewBugInput {
+ """A unique identifier for the client performing the mutation."""
+ clientMutationId: String
+ """"The name of the repository. If not set, the default repository is used."""
+ repoRef: String
+ """The title of the new bug."""
+ title: String!
+ """The first message of the new bug."""
+ message: String!
+ """The collection of file's hash required for the first message."""
+ files: [Hash!]
+}
+
+type NewBugPayload {
+ """A unique identifier for the client performing the mutation."""
+ clientMutationId: String
+ """The created bug."""
+ bug: Bug!
+ """The resulting operation."""
+ operation: CreateOperation!
+}
+
+input AddCommentInput {
+ """A unique identifier for the client performing the mutation."""
+ clientMutationId: String
+ """"The name of the repository. If not set, the default repository is used."""
+ repoRef: String
+ """The bug ID's prefix."""
+ prefix: String!
+ """The first message of the new bug."""
+ message: String!
+ """The collection of file's hash required for the first message."""
+ files: [Hash!]
+}
+
+type AddCommentPayload {
+ """A unique identifier for the client performing the mutation."""
+ clientMutationId: String
+ """The affected bug."""
+ bug: Bug!
+ """The resulting operation."""
+ operation: AddCommentOperation!
+}
+
+input ChangeLabelInput {
+ """A unique identifier for the client performing the mutation."""
+ clientMutationId: String
+ """"The name of the repository. If not set, the default repository is used."""
+ repoRef: String
+ """The bug ID's prefix."""
+ prefix: String!
+ """The list of label to add."""
+ added: [String!]
+ """The list of label to remove."""
+ Removed: [String!]
+}
+
+enum LabelChangeStatus {
+ ADDED
+ REMOVED
+ DUPLICATE_IN_OP
+ ALREADY_EXIST
+ DOESNT_EXIST
+}
+
+type LabelChangeResult {
+ """The source label."""
+ label: Label!
+ """The effect this label had."""
+ status: LabelChangeStatus!
+}
+
+type ChangeLabelPayload {
+ """A unique identifier for the client performing the mutation."""
+ clientMutationId: String
+ """The affected bug."""
+ bug: Bug!
+ """The resulting operation."""
+ operation: LabelChangeOperation!
+ """The effect each source label had."""
+ results: [LabelChangeResult]!
+}
+
+input OpenBugInput {
+ """A unique identifier for the client performing the mutation."""
+ clientMutationId: String
+ """"The name of the repository. If not set, the default repository is used."""
+ repoRef: String
+ """The bug ID's prefix."""
+ prefix: String!
+}
+
+type OpenBugPayload {
+ """A unique identifier for the client performing the mutation."""
+ clientMutationId: String
+ """The affected bug."""
+ bug: Bug!
+ """The resulting operation."""
+ operation: SetStatusOperation!
+}
+
+input CloseBugInput {
+ """A unique identifier for the client performing the mutation."""
+ clientMutationId: String
+ """"The name of the repository. If not set, the default repository is used."""
+ repoRef: String
+ """The bug ID's prefix."""
+ prefix: String!
+}
+
+type CloseBugPayload {
+ """A unique identifier for the client performing the mutation."""
+ clientMutationId: String
+ """The affected bug."""
+ bug: Bug!
+ """The resulting operation."""
+ operation: SetStatusOperation!
+}
+
+input SetTitleInput {
+ """A unique identifier for the client performing the mutation."""
+ clientMutationId: String
+ """"The name of the repository. If not set, the default repository is used."""
+ repoRef: String
+ """The bug ID's prefix."""
+ prefix: String!
+ """The new title."""
+ title: String!
+}
+
+type SetTitlePayload {
+ """A unique identifier for the client performing the mutation."""
+ clientMutationId: String
+ """The affected bug."""
+ bug: Bug!
+ """The resulting operation"""
+ operation: SetTitleOperation!
+}
+
+input CommitInput {
+ """A unique identifier for the client performing the mutation."""
+ clientMutationId: String
+ """"The name of the repository. If not set, the default repository is used."""
+ repoRef: String
+ """The bug ID's prefix."""
+ prefix: String!
+}
+
+type CommitPayload {
+ """A unique identifier for the client performing the mutation."""
+ clientMutationId: String
+ """The affected bug."""
+ bug: Bug!
+}
+
+input CommitAsNeededInput {
+ """A unique identifier for the client performing the mutation."""
+ clientMutationId: String
+ """"The name of the repository. If not set, the default repository is used."""
+ repoRef: String
+ """The bug ID's prefix."""
+ prefix: String!
+}
+
+type CommitAsNeededPayload {
+ """A unique identifier for the client performing the mutation."""
+ clientMutationId: String
+ """The affected bug."""
+ bug: Bug!
+}
diff --git a/graphql/schema/root.graphql b/graphql/schema/root.graphql
index 2d430aa5..3b497d95 100644
--- a/graphql/schema/root.graphql
+++ b/graphql/schema/root.graphql
@@ -1,16 +1,25 @@
type Query {
+ """The default unnamend repository."""
defaultRepository: Repository
- repository(id: String!): Repository
+ """Access a repository by reference/name."""
+ repository(ref: String!): Repository
}
type Mutation {
- newBug(repoRef: String, title: String!, message: String!, files: [Hash!]): Bug!
-
- addComment(repoRef: String, prefix: String!, message: String!, files: [Hash!]): Bug!
- changeLabels(repoRef: String, prefix: String!, added: [String!], removed: [String!]): Bug!
- open(repoRef: String, prefix: String!): Bug!
- close(repoRef: String, prefix: String!): Bug!
- setTitle(repoRef: String, prefix: String!, title: String!): Bug!
-
- commit(repoRef: String, prefix: String!): Bug!
+ """create a new bug"""
+ newBug(input: NewBugInput!): NewBugPayload!
+ """Add a new comment to a bug"""
+ addComment(input: AddCommentInput!): AddCommentPayload!
+ """Add or remove a set of label on a bug"""
+ changeLabels(input: ChangeLabelInput): ChangeLabelPayload!
+ """Change a bug's status to open"""
+ openBug(input: OpenBugInput!): OpenBugPayload!
+ """Change a bug's status to closed"""
+ closeBug(input: CloseBugInput!): CloseBugPayload!
+ """Change a bug's titlel"""
+ setTitle(input: SetTitleInput!): SetTitlePayload!
+ """Commit write the pending operations into storage. This mutation fail if nothing is pending"""
+ commit(input: CommitInput!): CommitPayload!
+ """Commit write the pending operations into storage. This mutation succed if nothing is pending"""
+ commitAsNeeded(input: CommitAsNeededInput!): CommitAsNeededPayload!
}