Design delta API
Created by: eseliger
Do the GraphQL schema design for the delta API.
Idea for a delta API
diff --git a/cmd/frontend/graphqlbackend/schema.graphql b/cmd/frontend/graphqlbackend/schema.graphql
index ec24543057..de99c386c6 100755
--- a/cmd/frontend/graphqlbackend/schema.graphql
+++ b/cmd/frontend/graphqlbackend/schema.graphql
@@ -683,6 +683,78 @@ enum ChangesetSpecType {
BRANCH
}
+"""
+Description of the current changeset state vs the changeset spec desired state.
+"""
+type ChangesetSpecDelta {
+ """
+ When run, the title of the changeset will be updated.
+ """
+ titleChanged: Boolean!
+ """
+ When run, the body of the changeset will be updated.
+ """
+ bodyChanged: Boolean!
+ """
+ When run, the changeset will be published as a draft.
+ """
+ draftChanged: Boolean!
+ """
+ When run, the target branch of the changeset will be updated.
+ """
+ baseRefChanged: Boolean!
+ """
+ When run, a new commit will be created on the branch of the changeset.
+ """
+ diffChanged: Boolean!
+ """
+ When run, a new commit will be created on the branch of the changeset.
+ """
+ commitMessageChanged: Boolean!
+ """
+ When run, a new commit in the name of the specified author will be created on the branch of the changeset.
+ """
+ authorNameChanged: Boolean!
+ """
+ When run, a new commit in the name of the specified author will be created on the branch of the changeset.
+ """
+ authorEmailChanged: Boolean!
+}
+
+"""
+This enum declares all operations supported by the reconciler.
+"""
+enum ChangesetSpecOperation {
+ """
+ Update the existing changeset on the codehost. This may include pushing a new commit, which will become clearer when we have the PUSH operation.
+ """
+ UPDATE
+ """
+ Move the existing changeset out of being a draft.
+ """
+ UNDRAFT
+ """
+ Publish a changeset to the codehost.
+ """
+ PUBLISH
+ """
+ Publish a changeset to the codehost as a draft changeset. (Only on supported code hosts).
+ """
+ PUBLISH_DRAFT
+ """
+ Sync the changeset with the current state on the codehost.
+ """
+ SYNC
+ """
+ Close the changeset on the codehost.
+ """
+ CLOSE
+ """
+ Reopen the changeset on the codehost.
+ """
+ REOPEN
+}
+
"""
A changeset spec is an immutable description of the desired state of a changeset in a campaign. To
create a changeset spec, use the createChangesetSpec mutation.
@@ -698,6 +770,21 @@ interface ChangesetSpec {
spec never expires (and this field is null) if its campaign spec has been applied.
"""
expiresAt: DateTime
+
+ """
+ The operations to take to achieve the desired state of this changeset spec.
+ """
+ operations: [ChangesetSpecOperation!]!
+
+ """
+ The delta between the current changeset state and what this changeset spec envisions the changeset to look like.
+ """
+ delta: ChangesetSpecDelta!
+
+ """
+ The changeset that this changeset spec will modify. Empty if the changeset spec creates a new changeset.
+ """
+ changeset: Changeset
}
"""
@@ -727,6 +814,21 @@ type HiddenChangesetSpec implements ChangesetSpec & Node {
spec never expires (and this field is null) if its campaign spec has been applied.
"""
expiresAt: DateTime
+
+ """
+ The operations to take to achieve the desired state of this changeset spec.
+ """
+ operations: [ChangesetSpecOperation!]!
+
+ """
+ The delta between the current changeset state and what this changeset spec envisions the changeset to look like.
+ """
+ delta: ChangesetSpecDelta!
+
+ """
+ The changeset that this changeset spec will modify. Empty if the changeset spec creates a new changeset.
+ """
+ changeset: Changeset
}
"""
@@ -761,6 +863,21 @@ type VisibleChangesetSpec implements ChangesetSpec & Node {
spec never expires (and this field is null) if its campaign spec has been applied.
"""
expiresAt: DateTime
+
+ """
+ The operations to take to achieve the desired state of this changeset spec.
+ """
+ operations: [ChangesetSpecOperation!]!
+
+ """
+ The delta between the current changeset state and what this changeset spec envisions the changeset to look like.
+ """
+ delta: ChangesetSpecDelta!
+
+ """
+ The changeset that this changeset spec will modify. Empty if the changeset spec creates a new changeset.
+ """
+ changeset: Changeset
}
"""