aboutsummaryrefslogtreecommitdiffstats
path: root/graphql
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-02-14 22:56:59 +0100
committerMichael Muré <batolettre@gmail.com>2020-02-14 22:56:59 +0100
commite9aff2a2a103b43852ecf7b57ae9ab297890eeed (patch)
treed66cb75151e42ada31e1d0179f8dba0ace388989 /graphql
parentb2ca506210b3eb63c4964e5bb47203fd5341ddf4 (diff)
parent2df72942f2b057956c7873f908b64880ab647331 (diff)
downloadgit-bug-e9aff2a2a103b43852ecf7b57ae9ab297890eeed.tar.gz
Merge remote-tracking branch 'origin/master' into cheshirekow-jira
Diffstat (limited to 'graphql')
-rw-r--r--graphql/graph/gen_graph.go627
-rw-r--r--graphql/graphql_test.go4
-rw-r--r--graphql/models/gen_models.go32
-rw-r--r--graphql/resolvers/mutation.go83
-rw-r--r--graphql/resolvers/query.go11
-rw-r--r--graphql/resolvers/repo.go7
-rw-r--r--graphql/schema/mutations.graphql32
-rw-r--r--graphql/schema/repository.graphql5
-rw-r--r--graphql/schema/root.graphql12
9 files changed, 107 insertions, 706 deletions
diff --git a/graphql/graph/gen_graph.go b/graphql/graph/gen_graph.go
index 67913377..5c84dae1 100644
--- a/graphql/graph/gen_graph.go
+++ b/graphql/graph/gen_graph.go
@@ -163,16 +163,6 @@ type ComplexityRoot struct {
Message func(childComplexity int) int
}
- CommitAsNeededPayload struct {
- Bug func(childComplexity int) int
- ClientMutationID func(childComplexity int) int
- }
-
- CommitPayload struct {
- Bug func(childComplexity int) int
- ClientMutationID func(childComplexity int) int
- }
-
CreateOperation struct {
Author func(childComplexity int) int
Date func(childComplexity int) int
@@ -264,14 +254,12 @@ type ComplexityRoot struct {
}
Mutation struct {
- AddComment func(childComplexity int, input models.AddCommentInput) int
- ChangeLabels func(childComplexity int, input *models.ChangeLabelInput) int
- CloseBug func(childComplexity int, input models.CloseBugInput) int
- Commit func(childComplexity int, input models.CommitInput) int
- CommitAsNeeded func(childComplexity int, input models.CommitAsNeededInput) int
- NewBug func(childComplexity int, input models.NewBugInput) int
- OpenBug func(childComplexity int, input models.OpenBugInput) int
- SetTitle func(childComplexity int, input models.SetTitleInput) int
+ AddComment func(childComplexity int, input models.AddCommentInput) int
+ ChangeLabels func(childComplexity int, input *models.ChangeLabelInput) int
+ CloseBug func(childComplexity int, input models.CloseBugInput) int
+ NewBug func(childComplexity int, input models.NewBugInput) int
+ OpenBug func(childComplexity int, input models.OpenBugInput) int
+ SetTitle func(childComplexity int, input models.SetTitleInput) int
}
NewBugPayload struct {
@@ -306,8 +294,7 @@ type ComplexityRoot struct {
}
Query struct {
- DefaultRepository func(childComplexity int) int
- Repository func(childComplexity int, ref string) int
+ Repository func(childComplexity int, ref *string) int
}
Repository struct {
@@ -315,6 +302,7 @@ type ComplexityRoot struct {
AllIdentities func(childComplexity int, after *string, before *string, first *int, last *int) int
Bug func(childComplexity int, prefix string) int
Identity func(childComplexity int, prefix string) int
+ Name func(childComplexity int) int
UserIdentity func(childComplexity int) int
ValidLabels func(childComplexity int, after *string, before *string, first *int, last *int) int
}
@@ -448,14 +436,12 @@ type MutationResolver interface {
OpenBug(ctx context.Context, input models.OpenBugInput) (*models.OpenBugPayload, error)
CloseBug(ctx context.Context, input models.CloseBugInput) (*models.CloseBugPayload, error)
SetTitle(ctx context.Context, input models.SetTitleInput) (*models.SetTitlePayload, error)
- Commit(ctx context.Context, input models.CommitInput) (*models.CommitPayload, error)
- CommitAsNeeded(ctx context.Context, input models.CommitAsNeededInput) (*models.CommitAsNeededPayload, error)
}
type QueryResolver interface {
- DefaultRepository(ctx context.Context) (*models.Repository, error)
- Repository(ctx context.Context, ref string) (*models.Repository, error)
+ Repository(ctx context.Context, ref *string) (*models.Repository, error)
}
type RepositoryResolver interface {
+ Name(ctx context.Context, obj *models.Repository) (*string, error)
AllBugs(ctx context.Context, obj *models.Repository, after *string, before *string, first *int, last *int, query *string) (*models.BugConnection, error)
Bug(ctx context.Context, obj *models.Repository, prefix string) (models.BugWrapper, error)
AllIdentities(ctx context.Context, obj *models.Repository, after *string, before *string, first *int, last *int) (*models.IdentityConnection, error)
@@ -925,34 +911,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.CommentHistoryStep.Message(childComplexity), true
- case "CommitAsNeededPayload.bug":
- if e.complexity.CommitAsNeededPayload.Bug == nil {
- break
- }
-
- return e.complexity.CommitAsNeededPayload.Bug(childComplexity), true
-
- case "CommitAsNeededPayload.clientMutationId":
- if e.complexity.CommitAsNeededPayload.ClientMutationID == nil {
- break
- }
-
- return e.complexity.CommitAsNeededPayload.ClientMutationID(childComplexity), true
-
- case "CommitPayload.bug":
- if e.complexity.CommitPayload.Bug == nil {
- break
- }
-
- return e.complexity.CommitPayload.Bug(childComplexity), true
-
- case "CommitPayload.clientMutationId":
- if e.complexity.CommitPayload.ClientMutationID == nil {
- break
- }
-
- return e.complexity.CommitPayload.ClientMutationID(childComplexity), true
-
case "CreateOperation.author":
if e.complexity.CreateOperation.Author == nil {
break
@@ -1367,30 +1325,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.Mutation.CloseBug(childComplexity, args["input"].(models.CloseBugInput)), true
- case "Mutation.commit":
- if e.complexity.Mutation.Commit == nil {
- break
- }
-
- args, err := ec.field_Mutation_commit_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.Commit(childComplexity, args["input"].(models.CommitInput)), true
-
- case "Mutation.commitAsNeeded":
- if e.complexity.Mutation.CommitAsNeeded == nil {
- break
- }
-
- args, err := ec.field_Mutation_commitAsNeeded_args(context.TODO(), rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.Mutation.CommitAsNeeded(childComplexity, args["input"].(models.CommitAsNeededInput)), true
-
case "Mutation.newBug":
if e.complexity.Mutation.NewBug == nil {
break
@@ -1539,13 +1473,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.PageInfo.StartCursor(childComplexity), true
- case "Query.defaultRepository":
- if e.complexity.Query.DefaultRepository == nil {
- break
- }
-
- return e.complexity.Query.DefaultRepository(childComplexity), true
-
case "Query.repository":
if e.complexity.Query.Repository == nil {
break
@@ -1556,7 +1483,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return 0, false
}
- return e.complexity.Query.Repository(childComplexity, args["ref"].(string)), true
+ return e.complexity.Query.Repository(childComplexity, args["ref"].(*string)), true
case "Repository.allBugs":
if e.complexity.Repository.AllBugs == nil {
@@ -1606,6 +1533,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.Repository.Identity(childComplexity, args["prefix"].(string)), true
+ case "Repository.name":
+ if e.complexity.Repository.Name == nil {
+ break
+ }
+
+ return e.complexity.Repository.Name(childComplexity), true
+
case "Repository.userIdentity":
if e.complexity.Repository.UserIdentity == nil {
break
@@ -2184,38 +2118,6 @@ type SetTitlePayload {
"""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!
-}
`, BuiltIn: false},
&ast.Source{Name: "schema/operations.graphql", Input: `"""An operation applied to a bug."""
interface Operation {
@@ -2320,6 +2222,9 @@ type LabelChangeOperation implements Operation & Authored {
`, BuiltIn: false},
&ast.Source{Name: "schema/repository.graphql", Input: `
type Repository {
+ """The name of the repository"""
+ name: String
+
"""All the bugs"""
allBugs(
"""Returns the elements in the list that come after the specified cursor."""
@@ -2330,7 +2235,7 @@ type Repository {
first: Int
"""Returns the last _n_ elements from the list."""
last: Int
- """A query to select and order bugs"""
+ """A query to select and order bugs."""
query: String
): BugConnection!
@@ -2366,12 +2271,8 @@ type Repository {
): LabelConnection!
}`, BuiltIn: false},
&ast.Source{Name: "schema/root.graphql", Input: `type Query {
- """The default unnamend repository."""
- defaultRepository: Repository
- """Access a repository by reference/name."""
- repository(ref: String!): Repository
-
- #TODO: connection for all repositories
+ """Access a repository by reference/name. If no ref is given, the default repository is returned if any."""
+ repository(ref: String): Repository
}
type Mutation {
@@ -2387,10 +2288,6 @@ type Mutation {
closeBug(input: CloseBugInput!): CloseBugPayload!
"""Change a bug's title"""
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!
}
`, BuiltIn: false},
&ast.Source{Name: "schema/timeline.graphql", Input: `"""An item in the timeline of events"""
@@ -2750,34 +2647,6 @@ func (ec *executionContext) field_Mutation_closeBug_args(ctx context.Context, ra
return args, nil
}
-func (ec *executionContext) field_Mutation_commitAsNeeded_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 models.CommitAsNeededInput
- if tmp, ok := rawArgs["input"]; ok {
- arg0, err = ec.unmarshalNCommitAsNeededInput2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCommitAsNeededInput(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["input"] = arg0
- return args, nil
-}
-
-func (ec *executionContext) field_Mutation_commit_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- var arg0 models.CommitInput
- if tmp, ok := rawArgs["input"]; ok {
- arg0, err = ec.unmarshalNCommitInput2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCommitInput(ctx, tmp)
- if err != nil {
- return nil, err
- }
- }
- args["input"] = arg0
- return args, nil
-}
-
func (ec *executionContext) field_Mutation_newBug_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
var err error
args := map[string]interface{}{}
@@ -2837,9 +2706,9 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs
func (ec *executionContext) field_Query_repository_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
var err error
args := map[string]interface{}{}
- var arg0 string
+ var arg0 *string
if tmp, ok := rawArgs["ref"]; ok {
- arg0, err = ec.unmarshalNString2string(ctx, tmp)
+ arg0, err = ec.unmarshalOString2ᚖstring(ctx, tmp)
if err != nil {
return nil, err
}
@@ -4998,136 +4867,6 @@ func (ec *executionContext) _CommentHistoryStep_date(ctx context.Context, field
return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res)
}
-func (ec *executionContext) _CommitAsNeededPayload_clientMutationId(ctx context.Context, field graphql.CollectedField, obj *models.CommitAsNeededPayload) (ret graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- fc := &graphql.FieldContext{
- Object: "CommitAsNeededPayload",
- Field: field,
- Args: nil,
- IsMethod: false,
- }
-
- ctx = graphql.WithFieldContext(ctx, fc)
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ClientMutationID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) _CommitAsNeededPayload_bug(ctx context.Context, field graphql.CollectedField, obj *models.CommitAsNeededPayload) (ret graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- fc := &graphql.FieldContext{
- Object: "CommitAsNeededPayload",
- Field: field,
- Args: nil,
- IsMethod: false,
- }
-
- ctx = graphql.WithFieldContext(ctx, fc)
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Bug, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(models.BugWrapper)
- fc.Result = res
- return ec.marshalNBug2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐBugWrapper(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) _CommitPayload_clientMutationId(ctx context.Context, field graphql.CollectedField, obj *models.CommitPayload) (ret graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- fc := &graphql.FieldContext{
- Object: "CommitPayload",
- Field: field,
- Args: nil,
- IsMethod: false,
- }
-
- ctx = graphql.WithFieldContext(ctx, fc)
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.ClientMutationID, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- return graphql.Null
- }
- res := resTmp.(*string)
- fc.Result = res
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) _CommitPayload_bug(ctx context.Context, field graphql.CollectedField, obj *models.CommitPayload) (ret graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- fc := &graphql.FieldContext{
- Object: "CommitPayload",
- Field: field,
- Args: nil,
- IsMethod: false,
- }
-
- ctx = graphql.WithFieldContext(ctx, fc)
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return obj.Bug, nil
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(models.BugWrapper)
- fc.Result = res
- return ec.marshalNBug2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐBugWrapper(ctx, field.Selections, res)
-}
-
func (ec *executionContext) _CreateOperation_id(ctx context.Context, field graphql.CollectedField, obj *bug.CreateOperation) (ret graphql.Marshaler) {
defer func() {
if r := recover(); r != nil {
@@ -7201,88 +6940,6 @@ func (ec *executionContext) _Mutation_setTitle(ctx context.Context, field graphq
return ec.marshalNSetTitlePayload2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐSetTitlePayload(ctx, field.Selections, res)
}
-func (ec *executionContext) _Mutation_commit(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- fc := &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- Args: nil,
- IsMethod: true,
- }
-
- ctx = graphql.WithFieldContext(ctx, fc)
- rawArgs := field.ArgumentMap(ec.Variables)
- args, err := ec.field_Mutation_commit_args(ctx, rawArgs)
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- fc.Args = args
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().Commit(rctx, args["input"].(models.CommitInput))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*models.CommitPayload)
- fc.Result = res
- return ec.marshalNCommitPayload2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCommitPayload(ctx, field.Selections, res)
-}
-
-func (ec *executionContext) _Mutation_commitAsNeeded(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- }()
- fc := &graphql.FieldContext{
- Object: "Mutation",
- Field: field,
- Args: nil,
- IsMethod: true,
- }
-
- ctx = graphql.WithFieldContext(ctx, fc)
- rawArgs := field.ArgumentMap(ec.Variables)
- args, err := ec.field_Mutation_commitAsNeeded_args(ctx, rawArgs)
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- fc.Args = args
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Mutation().CommitAsNeeded(rctx, args["input"].(models.CommitAsNeededInput))
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if resTmp == nil {
- if !graphql.HasFieldError(ctx, fc) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- res := resTmp.(*models.CommitAsNeededPayload)
- fc.Result = res
- return ec.marshalNCommitAsNeededPayload2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCommitAsNeededPayload(ctx, field.Selections, res)
-}
-
func (ec *executionContext) _NewBugPayload_clientMutationId(ctx context.Context, field graphql.CollectedField, obj *models.NewBugPayload) (ret graphql.Marshaler) {
defer func() {
if r := recover(); r != nil {
@@ -7821,7 +7478,7 @@ func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graph
return ec.marshalNString2string(ctx, field.Selections, res)
}
-func (ec *executionContext) _Query_defaultRepository(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
+func (ec *executionContext) _Query_repository(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
@@ -7836,9 +7493,16 @@ func (ec *executionContext) _Query_defaultRepository(ctx context.Context, field
}
ctx = graphql.WithFieldContext(ctx, fc)
+ rawArgs := field.ArgumentMap(ec.Variables)
+ args, err := ec.field_Query_repository_args(ctx, rawArgs)
+ if err != nil {
+ ec.Error(ctx, err)
+ return graphql.Null
+ }
+ fc.Args = args
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().DefaultRepository(rctx)
+ return ec.resolvers.Query().Repository(rctx, args["ref"].(*string))
})
if err != nil {
ec.Error(ctx, err)
@@ -7852,7 +7516,7 @@ func (ec *executionContext) _Query_defaultRepository(ctx context.Context, field
return ec.marshalORepository2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐRepository(ctx, field.Selections, res)
}
-func (ec *executionContext) _Query_repository(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
+func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
@@ -7868,7 +7532,7 @@ func (ec *executionContext) _Query_repository(ctx context.Context, field graphql
ctx = graphql.WithFieldContext(ctx, fc)
rawArgs := field.ArgumentMap(ec.Variables)
- args, err := ec.field_Query_repository_args(ctx, rawArgs)
+ args, err := ec.field_Query___type_args(ctx, rawArgs)
if err != nil {
ec.Error(ctx, err)
return graphql.Null
@@ -7876,7 +7540,7 @@ func (ec *executionContext) _Query_repository(ctx context.Context, field graphql
fc.Args = args
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Query().Repository(rctx, args["ref"].(string))
+ return ec.introspectType(args["name"].(string))
})
if err != nil {
ec.Error(ctx, err)
@@ -7885,12 +7549,12 @@ func (ec *executionContext) _Query_repository(ctx context.Context, field graphql
if resTmp == nil {
return graphql.Null
}
- res := resTmp.(*models.Repository)
+ res := resTmp.(*introspection.Type)
fc.Result = res
- return ec.marshalORepository2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐRepository(ctx, field.Selections, res)
+ return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res)
}
-func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
+func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
@@ -7905,16 +7569,9 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col
}
ctx = graphql.WithFieldContext(ctx, fc)
- rawArgs := field.ArgumentMap(ec.Variables)
- args, err := ec.field_Query___type_args(ctx, rawArgs)
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- fc.Args = args
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
- return ec.introspectType(args["name"].(string))
+ return ec.introspectSchema()
})
if err != nil {
ec.Error(ctx, err)
@@ -7923,12 +7580,12 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col
if resTmp == nil {
return graphql.Null
}
- res := resTmp.(*introspection.Type)
+ res := resTmp.(*introspection.Schema)
fc.Result = res
- return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res)
+ return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res)
}
-func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
+func (ec *executionContext) _Repository_name(ctx context.Context, field graphql.CollectedField, obj *models.Repository) (ret graphql.Marshaler) {
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
@@ -7936,7 +7593,7 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C
}
}()
fc := &graphql.FieldContext{
- Object: "Query",
+ Object: "Repository",
Field: field,
Args: nil,
IsMethod: true,
@@ -7945,7 +7602,7 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C
ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
- return ec.introspectSchema()
+ return ec.resolvers.Repository().Name(rctx, obj)
})
if err != nil {
ec.Error(ctx, err)
@@ -7954,9 +7611,9 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C
if resTmp == nil {
return graphql.Null
}
- res := resTmp.(*introspection.Schema)
+ res := resTmp.(*string)
fc.Result = res
- return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res)
+ return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
}
func (ec *executionContext) _Repository_allBugs(ctx context.Context, field graphql.CollectedField, obj *models.Repository) (ret graphql.Marshaler) {
@@ -10273,66 +9930,6 @@ func (ec *executionContext) unmarshalInputCloseBugInput(ctx context.Context, obj
return it, nil
}
-func (ec *executionContext) unmarshalInputCommitAsNeededInput(ctx context.Context, obj interface{}) (models.CommitAsNeededInput, error) {
- var it models.CommitAsNeededInput
- var asMap = obj.(map[string]interface{})
-
- for k, v := range asMap {
- switch k {
- case "clientMutationId":
- var err error
- it.ClientMutationID, err = ec.unmarshalOString2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- case "repoRef":
- var err error
- it.RepoRef, err = ec.unmarshalOString2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- case "prefix":
- var err error
- it.Prefix, err = ec.unmarshalNString2string(ctx, v)
- if err != nil {
- return it, err
- }
- }
- }
-
- return it, nil
-}
-
-func (ec *executionContext) unmarshalInputCommitInput(ctx context.Context, obj interface{}) (models.CommitInput, error) {
- var it models.CommitInput
- var asMap = obj.(map[string]interface{})
-
- for k, v := range asMap {
- switch k {
- case "clientMutationId":
- var err error
- it.ClientMutationID, err = ec.unmarshalOString2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- case "repoRef":
- var err error
- it.RepoRef, err = ec.unmarshalOString2ᚖstring(ctx, v)
- if err != nil {
- return it, err
- }
- case "prefix":
- var err error
- it.Prefix, err = ec.unmarshalNString2string(ctx, v)
- if err != nil {
- return it, err
- }
- }
- }
-
- return it, nil
-}
-
func (ec *executionContext) unmarshalInputNewBugInput(ctx context.Context, obj interface{}) (models.NewBugInput, error) {
var it models.NewBugInput
var asMap = obj.(map[string]interface{})
@@ -11346,64 +10943,6 @@ func (ec *executionContext) _CommentHistoryStep(ctx context.Context, sel ast.Sel
return out
}
-var commitAsNeededPayloadImplementors = []string{"CommitAsNeededPayload"}
-
-func (ec *executionContext) _CommitAsNeededPayload(ctx context.Context, sel ast.SelectionSet, obj *models.CommitAsNeededPayload) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, commitAsNeededPayloadImplementors)
-
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("CommitAsNeededPayload")
- case "clientMutationId":
- out.Values[i] = ec._CommitAsNeededPayload_clientMutationId(ctx, field, obj)
- case "bug":
- out.Values[i] = ec._CommitAsNeededPayload_bug(ctx, field, obj)
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
-var commitPayloadImplementors = []string{"CommitPayload"}
-
-func (ec *executionContext) _CommitPayload(ctx context.Context, sel ast.SelectionSet, obj *models.CommitPayload) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, commitPayloadImplementors)
-
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("CommitPayload")
- case "clientMutationId":
- out.Values[i] = ec._CommitPayload_clientMutationId(ctx, field, obj)
- case "bug":
- out.Values[i] = ec._CommitPayload_bug(ctx, field, obj)
- if out.Values[i] == graphql.Null {
- invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 {
- return graphql.Null
- }
- return out
-}
-
var createOperationImplementors = []string{"CreateOperation", "Operation", "Authored"}
func (ec *executionContext) _CreateOperation(ctx context.Context, sel ast.SelectionSet, obj *bug.CreateOperation) graphql.Marshaler {
@@ -12172,16 +11711,6 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet)
if out.Values[i] == graphql.Null {
invalids++
}
- case "commit":
- out.Values[i] = ec._Mutation_commit(ctx, field)
- if out.Values[i] == graphql.Null {
- invalids++
- }
- case "commitAsNeeded":
- out.Values[i] = ec._Mutation_commitAsNeeded(ctx, field)
- if out.Values[i] == graphql.Null {
- invalids++
- }
default:
panic("unknown field " + strconv.Quote(field.Name))
}
@@ -12392,17 +11921,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
switch field.Name {
case "__typename":
out.Values[i] = graphql.MarshalString("Query")
- case "defaultRepository":
- field := field
- out.Concurrently(i, func() (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Query_defaultRepository(ctx, field)
- return res
- })
case "repository":
field := field
out.Concurrently(i, func() (res graphql.Marshaler) {
@@ -12440,6 +11958,17 @@ func (ec *executionContext) _Repository(ctx context.Context, sel ast.SelectionSe
switch field.Name {
case "__typename":
out.Values[i] = graphql.MarshalString("Repository")
+ case "name":
+ field := field
+ out.Concurrently(i, func() (res graphql.Marshaler) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ }
+ }()
+ res = ec._Repository_name(ctx, field, obj)
+ return res
+ })
case "allBugs":
field := field
out.Concurrently(i, func() (res graphql.Marshaler) {
@@ -13544,42 +13073,6 @@ func (ec *executionContext) marshalNCommentHistoryStep2ᚕgithubᚗcomᚋMichael
return ret
}
-func (ec *executionContext) unmarshalNCommitAsNeededInput2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCommitAsNeededInput(ctx context.Context, v interface{}) (models.CommitAsNeededInput, error) {
- return ec.unmarshalInputCommitAsNeededInput(ctx, v)
-}
-
-func (ec *executionContext) marshalNCommitAsNeededPayload2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCommitAsNeededPayload(ctx context.Context, sel ast.SelectionSet, v models.CommitAsNeededPayload) graphql.Marshaler {
- return ec._CommitAsNeededPayload(ctx, sel, &v)
-}
-
-func (ec *executionContext) marshalNCommitAsNeededPayload2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCommitAsNeededPayload(ctx context.Context, sel ast.SelectionSet, v *models.CommitAsNeededPayload) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- return ec._CommitAsNeededPayload(ctx, sel, v)
-}
-
-func (ec *executionContext) unmarshalNCommitInput2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCommitInput(ctx context.Context, v interface{}) (models.CommitInput, error) {
- return ec.unmarshalInputCommitInput(ctx, v)
-}
-
-func (ec *executionContext) marshalNCommitPayload2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCommitPayload(ctx context.Context, sel ast.SelectionSet, v models.CommitPayload) graphql.Marshaler {
- return ec._CommitPayload(ctx, sel, &v)
-}
-
-func (ec *executionContext) marshalNCommitPayload2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCommitPayload(ctx context.Context, sel ast.SelectionSet, v *models.CommitPayload) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- ec.Errorf(ctx, "must not be null")
- }
- return graphql.Null
- }
- return ec._CommitPayload(ctx, sel, v)
-}
-
func (ec *executionContext) marshalNCreateOperation2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐCreateOperation(ctx context.Context, sel ast.SelectionSet, v bug.CreateOperation) graphql.Marshaler {
return ec._CreateOperation(ctx, sel, &v)
}
diff --git a/graphql/graphql_test.go b/graphql/graphql_test.go
index 4bab7f58..19770150 100644
--- a/graphql/graphql_test.go
+++ b/graphql/graphql_test.go
@@ -25,7 +25,7 @@ func TestQueries(t *testing.T) {
query := `
query {
- defaultRepository {
+ repository {
allBugs(first: 2) {
pageInfo {
endCursor
@@ -162,7 +162,7 @@ func TestQueries(t *testing.T) {
}
var resp struct {
- DefaultRepository struct {
+ Repository struct {
AllBugs struct {
PageInfo models.PageInfo
Nodes []struct {
diff --git a/graphql/models/gen_models.go b/graphql/models/gen_models.go
index b3e14655..cbece6fe 100644
--- a/graphql/models/gen_models.go
+++ b/graphql/models/gen_models.go
@@ -111,38 +111,6 @@ type CommentEdge struct {
Node *bug.Comment `json:"node"`
}
-type CommitAsNeededInput struct {
- // A unique identifier for the client performing the mutation.
- ClientMutationID *string `json:"clientMutationId"`
- // "The name of the repository. If not set, the default repository is used.
- RepoRef *string `json:"repoRef"`
- // The bug ID's prefix.
- Prefix string `json:"prefix"`
-}
-
-type CommitAsNeededPayload struct {
- // A unique identifier for the client performing the mutation.
- ClientMutationID *string `json:"clientMutationId"`
- // The affected bug.
- Bug BugWrapper `json:"bug"`
-}
-
-type CommitInput struct {
- // A unique identifier for the client performing the mutation.
- ClientMutationID *string `json:"clientMutationId"`
- // "The name of the repository. If not set, the default repository is used.
- RepoRef *string `json:"repoRef"`
- // The bug ID's prefix.
- Prefix string `json:"prefix"`
-}
-
-type CommitPayload struct {
- // A unique identifier for the client performing the mutation.
- ClientMutationID *string `json:"clientMutationId"`
- // The affected bug.
- Bug BugWrapper `json:"bug"`
-}
-
type IdentityConnection struct {
Edges []*IdentityEdge `json:"edges"`
Nodes []IdentityWrapper `json:"nodes"`
diff --git a/graphql/resolvers/mutation.go b/graphql/resolvers/mutation.go
index 889edbc8..850645f4 100644
--- a/graphql/resolvers/mutation.go
+++ b/graphql/resolvers/mutation.go
@@ -23,6 +23,15 @@ func (r mutationResolver) getRepo(ref *string) (*cache.RepoCache, error) {
return r.cache.DefaultRepo()
}
+func (r mutationResolver) getBug(repoRef *string, bugPrefix string) (*cache.BugCache, error) {
+ repo, err := r.getRepo(repoRef)
+ if err != nil {
+ return nil, err
+ }
+
+ return repo.ResolveBugPrefix(bugPrefix)
+}
+
func (r mutationResolver) NewBug(_ context.Context, input models.NewBugInput) (*models.NewBugPayload, error) {
repo, err := r.getRepo(input.RepoRef)
if err != nil {
@@ -42,17 +51,17 @@ func (r mutationResolver) NewBug(_ context.Context, input models.NewBugInput) (*
}
func (r mutationResolver) AddComment(_ context.Context, input models.AddCommentInput) (*models.AddCommentPayload, error) {
- repo, err := r.getRepo(input.RepoRef)
+ b, err := r.getBug(input.RepoRef, input.Prefix)
if err != nil {
return nil, err
}
- b, err := repo.ResolveBugPrefix(input.Prefix)
+ op, err := b.AddCommentWithFiles(input.Message, input.Files)
if err != nil {
return nil, err
}
- op, err := b.AddCommentWithFiles(input.Message, input.Files)
+ err = b.Commit()
if err != nil {
return nil, err
}
@@ -65,17 +74,17 @@ func (r mutationResolver) AddComment(_ context.Context, input models.AddCommentI
}
func (r mutationResolver) ChangeLabels(_ context.Context, input *models.ChangeLabelInput) (*models.ChangeLabelPayload, error) {
- repo, err := r.getRepo(input.RepoRef)
+ b, err := r.getBug(input.RepoRef, input.Prefix)
if err != nil {
return nil, err
}
- b, err := repo.ResolveBugPrefix(input.Prefix)
+ results, op, err := b.ChangeLabels(input.Added, input.Removed)
if err != nil {
return nil, err
}
- results, op, err := b.ChangeLabels(input.Added, input.Removed)
+ err = b.Commit()
if err != nil {
return nil, err
}
@@ -94,17 +103,17 @@ func (r mutationResolver) ChangeLabels(_ context.Context, input *models.ChangeLa
}
func (r mutationResolver) OpenBug(_ context.Context, input models.OpenBugInput) (*models.OpenBugPayload, error) {
- repo, err := r.getRepo(input.RepoRef)
+ b, err := r.getBug(input.RepoRef, input.Prefix)
if err != nil {
return nil, err
}
- b, err := repo.ResolveBugPrefix(input.Prefix)
+ op, err := b.Open()
if err != nil {
return nil, err
}
- op, err := b.Open()
+ err = b.Commit()
if err != nil {
return nil, err
}
@@ -117,17 +126,17 @@ func (r mutationResolver) OpenBug(_ context.Context, input models.OpenBugInput)
}
func (r mutationResolver) CloseBug(_ context.Context, input models.CloseBugInput) (*models.CloseBugPayload, error) {
- repo, err := r.getRepo(input.RepoRef)
+ b, err := r.getBug(input.RepoRef, input.Prefix)
if err != nil {
return nil, err
}
- b, err := repo.ResolveBugPrefix(input.Prefix)
+ op, err := b.Close()
if err != nil {
return nil, err
}
- op, err := b.Close()
+ err = b.Commit()
if err != nil {
return nil, err
}
@@ -140,12 +149,7 @@ func (r mutationResolver) CloseBug(_ context.Context, input models.CloseBugInput
}
func (r mutationResolver) SetTitle(_ context.Context, input models.SetTitleInput) (*models.SetTitlePayload, error) {
- repo, err := r.getRepo(input.RepoRef)
- if err != nil {
- return nil, err
- }
-
- b, err := repo.ResolveBugPrefix(input.Prefix)
+ b, err := r.getBug(input.RepoRef, input.Prefix)
if err != nil {
return nil, err
}
@@ -155,53 +159,14 @@ func (r mutationResolver) SetTitle(_ context.Context, input models.SetTitleInput
return nil, err
}
- return &models.SetTitlePayload{
- ClientMutationID: input.ClientMutationID,
- Bug: models.NewLoadedBug(b.Snapshot()),
- Operation: op,
- }, nil
-}
-
-func (r mutationResolver) Commit(_ context.Context, input models.CommitInput) (*models.CommitPayload, error) {
- repo, err := r.getRepo(input.RepoRef)
- if err != nil {
- return nil, err
- }
-
- b, err := repo.ResolveBugPrefix(input.Prefix)
- if err != nil {
- return nil, err
- }
-
err = b.Commit()
if err != nil {
return nil, err
}
- return &models.CommitPayload{
- ClientMutationID: input.ClientMutationID,
- Bug: models.NewLoadedBug(b.Snapshot()),
- }, nil
-}
-
-func (r mutationResolver) CommitAsNeeded(_ context.Context, input models.CommitAsNeededInput) (*models.CommitAsNeededPayload, error) {
- repo, err := r.getRepo(input.RepoRef)
- if err != nil {
- return nil, err
- }
-
- b, err := repo.ResolveBugPrefix(input.Prefix)
- if err != nil {
- return nil, err
- }
-
- err = b.CommitAsNeeded()
- if err != nil {
- return nil, err
- }
-
- return &models.CommitAsNeededPayload{
+ return &models.SetTitlePayload{
ClientMutationID: input.ClientMutationID,
Bug: models.NewLoadedBug(b.Snapshot()),
+ Operation: op,
}, nil
}
diff --git a/graphql/resolvers/query.go b/graphql/resolvers/query.go
index 9503ccf4..6fb18638 100644
--- a/graphql/resolvers/query.go
+++ b/graphql/resolvers/query.go
@@ -27,8 +27,15 @@ func (r rootQueryResolver) DefaultRepository(_ context.Context) (*models.Reposit
}, nil
}
-func (r rootQueryResolver) Repository(_ context.Context, ref string) (*models.Repository, error) {
- repo, err := r.cache.ResolveRepo(ref)
+func (r rootQueryResolver) Repository(_ context.Context, ref *string) (*models.Repository, error) {
+ var repo *cache.RepoCache
+ var err error
+
+ if ref == nil {
+ repo, err = r.cache.DefaultRepo()
+ } else {
+ repo, err = r.cache.ResolveRepo(*ref)
+ }
if err != nil {
return nil, err
diff --git a/graphql/resolvers/repo.go b/graphql/resolvers/repo.go
index 3b0aa9a1..d090544d 100644
--- a/graphql/resolvers/repo.go
+++ b/graphql/resolvers/repo.go
@@ -15,6 +15,11 @@ var _ graph.RepositoryResolver = &repoResolver{}
type repoResolver struct{}
+func (repoResolver) Name(_ context.Context, obj *models.Repository) (*string, error) {
+ name := obj.Repo.Name()
+ return &name, nil
+}
+
func (repoResolver) AllBugs(_ context.Context, obj *models.Repository, after *string, before *string, first *int, last *int, queryStr *string) (*models.BugConnection, error) {
input := models.ConnectionInput{
Before: before,
@@ -153,7 +158,7 @@ func (repoResolver) UserIdentity(_ context.Context, obj *models.Repository) (mod
return models.NewLazyIdentity(obj.Repo, excerpt), nil
}
-func (resolver repoResolver) ValidLabels(_ context.Context, obj *models.Repository, after *string, before *string, first *int, last *int) (*models.LabelConnection, error) {
+func (repoResolver) ValidLabels(_ context.Context, obj *models.Repository, after *string, before *string, first *int, last *int) (*models.LabelConnection, error) {
input := models.ConnectionInput{
Before: before,
After: after,
diff --git a/graphql/schema/mutations.graphql b/graphql/schema/mutations.graphql
index 3eeeae6a..e6b70faf 100644
--- a/graphql/schema/mutations.graphql
+++ b/graphql/schema/mutations.graphql
@@ -136,35 +136,3 @@ type SetTitlePayload {
"""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/repository.graphql b/graphql/schema/repository.graphql
index 20a3cf0b..2b98fe37 100644
--- a/graphql/schema/repository.graphql
+++ b/graphql/schema/repository.graphql
@@ -1,5 +1,8 @@
type Repository {
+ """The name of the repository"""
+ name: String
+
"""All the bugs"""
allBugs(
"""Returns the elements in the list that come after the specified cursor."""
@@ -10,7 +13,7 @@ type Repository {
first: Int
"""Returns the last _n_ elements from the list."""
last: Int
- """A query to select and order bugs"""
+ """A query to select and order bugs."""
query: String
): BugConnection!
diff --git a/graphql/schema/root.graphql b/graphql/schema/root.graphql
index 2a12cc37..94a0b530 100644
--- a/graphql/schema/root.graphql
+++ b/graphql/schema/root.graphql
@@ -1,10 +1,6 @@
type Query {
- """The default unnamend repository."""
- defaultRepository: Repository
- """Access a repository by reference/name."""
- repository(ref: String!): Repository
-
- #TODO: connection for all repositories
+ """Access a repository by reference/name. If no ref is given, the default repository is returned if any."""
+ repository(ref: String): Repository
}
type Mutation {
@@ -20,8 +16,4 @@ type Mutation {
closeBug(input: CloseBugInput!): CloseBugPayload!
"""Change a bug's title"""
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!
}