From bc6d5d67ac58d0a123e299a5e2d62420ea99dd60 Mon Sep 17 00:00:00 2001 From: Islam Aleiv Date: Thu, 29 Feb 2024 12:31:26 +0100 Subject: [PATCH] Polish --- request/graphql/schema/collection.go | 10 ++++------ request/graphql/schema/generate.go | 10 ++++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/request/graphql/schema/collection.go b/request/graphql/schema/collection.go index ca093f9403..4680bdceff 100644 --- a/request/graphql/schema/collection.go +++ b/request/graphql/schema/collection.go @@ -44,11 +44,11 @@ func FromString(ctx context.Context, schemaString string) ( return nil, err } - return fromAst(ctx, doc) + return fromAst(doc) } // fromAst parses a GQL AST into a set of collection descriptions. -func fromAst(ctx context.Context, doc *ast.Document) ( +func fromAst(doc *ast.Document) ( []client.CollectionDefinition, error, ) { @@ -58,7 +58,7 @@ func fromAst(ctx context.Context, doc *ast.Document) ( for _, def := range doc.Definitions { switch defType := def.(type) { case *ast.ObjectDefinition: - description, err := collectionFromAstDefinition(ctx, relationManager, defType) + description, err := collectionFromAstDefinition(relationManager, defType) if err != nil { return nil, err } @@ -66,7 +66,7 @@ func fromAst(ctx context.Context, doc *ast.Document) ( definitions = append(definitions, description) case *ast.InterfaceDefinition: - description, err := schemaFromAstDefinition(ctx, relationManager, defType) + description, err := schemaFromAstDefinition(relationManager, defType) if err != nil { return nil, err } @@ -98,7 +98,6 @@ func fromAst(ctx context.Context, doc *ast.Document) ( // collectionFromAstDefinition parses a AST object definition into a set of collection descriptions. func collectionFromAstDefinition( - ctx context.Context, relationManager *RelationManager, def *ast.ObjectDefinition, ) (client.CollectionDefinition, error) { @@ -164,7 +163,6 @@ func collectionFromAstDefinition( } func schemaFromAstDefinition( - ctx context.Context, relationManager *RelationManager, def *ast.InterfaceDefinition, ) (client.SchemaDescription, error) { diff --git a/request/graphql/schema/generate.go b/request/graphql/schema/generate.go index 32fe562cff..e4397e2e40 100644 --- a/request/graphql/schema/generate.go +++ b/request/graphql/schema/generate.go @@ -82,7 +82,7 @@ func (g *Generator) Generate(ctx context.Context, collections []client.Collectio // the given CollectionDescriptions. func (g *Generator) generate(ctx context.Context, collections []client.CollectionDefinition) ([]*gql.Object, error) { // build base types - defs, err := g.buildTypes(ctx, collections) + defs, err := g.buildTypes(collections) if err != nil { return nil, err } @@ -129,7 +129,7 @@ func (g *Generator) generate(ctx context.Context, collections []client.Collectio return nil, err } - if err := g.genAggregateFields(ctx); err != nil { + if err := g.genAggregateFields(); err != nil { return nil, err } // resolve types @@ -403,7 +403,6 @@ func (g *Generator) createExpandedFieldList( // Given a set of developer defined collection types // extract and return the correct gql.Object type(s) func (g *Generator) buildTypes( - ctx context.Context, collections []client.CollectionDefinition, ) ([]*gql.Object, error) { // @todo: Check for duplicate named defined types in the TypeMap @@ -594,7 +593,7 @@ func (g *Generator) buildMutationInputTypes(collections []client.CollectionDefin return nil } -func (g *Generator) genAggregateFields(ctx context.Context) error { +func (g *Generator) genAggregateFields() error { topLevelCountInputs := map[string]*gql.InputObject{} topLevelNumericAggInputs := map[string]*gql.InputObject{} @@ -1014,7 +1013,7 @@ func (g *Generator) GenerateQueryInputForGQLType( types.groupBy = g.genTypeFieldsEnum(obj) types.order = g.genTypeOrderArgInput(obj) - queryField := g.genTypeQueryableFieldList(ctx, obj, types) + queryField := g.genTypeQueryableFieldList(obj, types) return queryField, nil } @@ -1249,7 +1248,6 @@ type queryInputTypeConfig struct { } func (g *Generator) genTypeQueryableFieldList( - ctx context.Context, obj *gql.Object, config queryInputTypeConfig, ) *gql.Field {