feat: add full SDL to SupGraph response
This commit is contained in:
@@ -16,6 +16,7 @@ import (
|
||||
"github.com/99designs/gqlgen/graphql/introspection"
|
||||
gqlparser "github.com/vektah/gqlparser/v2"
|
||||
"github.com/vektah/gqlparser/v2/ast"
|
||||
|
||||
"gitlab.com/unboundsoftware/schemas/graph/model"
|
||||
)
|
||||
|
||||
@@ -89,6 +90,7 @@ type ComplexityRoot struct {
|
||||
SubGraphs struct {
|
||||
ID func(childComplexity int) int
|
||||
MinDelaySeconds func(childComplexity int) int
|
||||
Sdl func(childComplexity int) int
|
||||
SubGraphs func(childComplexity int) int
|
||||
}
|
||||
|
||||
@@ -326,6 +328,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
||||
|
||||
return e.complexity.SubGraphs.MinDelaySeconds(childComplexity), true
|
||||
|
||||
case "SubGraphs.sdl":
|
||||
if e.complexity.SubGraphs.Sdl == nil {
|
||||
break
|
||||
}
|
||||
|
||||
return e.complexity.SubGraphs.Sdl(childComplexity), true
|
||||
|
||||
case "SubGraphs.subGraphs":
|
||||
if e.complexity.SubGraphs.SubGraphs == nil {
|
||||
break
|
||||
@@ -503,6 +512,7 @@ type Unchanged {
|
||||
type SubGraphs {
|
||||
id: ID!
|
||||
minDelaySeconds: Int!
|
||||
sdl: String!
|
||||
subGraphs: [SubGraph!]!
|
||||
}
|
||||
|
||||
@@ -2155,6 +2165,50 @@ func (ec *executionContext) fieldContext_SubGraphs_minDelaySeconds(ctx context.C
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _SubGraphs_sdl(ctx context.Context, field graphql.CollectedField, obj *model.SubGraphs) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_SubGraphs_sdl(ctx, field)
|
||||
if err != nil {
|
||||
return graphql.Null
|
||||
}
|
||||
ctx = graphql.WithFieldContext(ctx, fc)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = graphql.Null
|
||||
}
|
||||
}()
|
||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||
ctx = rctx // use context from middleware stack in children
|
||||
return obj.Sdl, 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.(string)
|
||||
fc.Result = res
|
||||
return ec.marshalNString2string(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) fieldContext_SubGraphs_sdl(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||
fc = &graphql.FieldContext{
|
||||
Object: "SubGraphs",
|
||||
Field: field,
|
||||
IsMethod: false,
|
||||
IsResolver: false,
|
||||
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||
return nil, errors.New("field of type String does not have child fields")
|
||||
},
|
||||
}
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _SubGraphs_subGraphs(ctx context.Context, field graphql.CollectedField, obj *model.SubGraphs) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_SubGraphs_subGraphs(ctx, field)
|
||||
if err != nil {
|
||||
@@ -4622,6 +4676,11 @@ func (ec *executionContext) _SubGraphs(ctx context.Context, sel ast.SelectionSet
|
||||
if out.Values[i] == graphql.Null {
|
||||
out.Invalids++
|
||||
}
|
||||
case "sdl":
|
||||
out.Values[i] = ec._SubGraphs_sdl(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
out.Invalids++
|
||||
}
|
||||
case "subGraphs":
|
||||
out.Values[i] = ec._SubGraphs_subGraphs(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
|
||||
Reference in New Issue
Block a user