diff --git a/internal/request/graphql/schema/descriptions.go b/internal/request/graphql/schema/descriptions.go index 6f89932c0a..281002366a 100644 --- a/internal/request/graphql/schema/descriptions.go +++ b/internal/request/graphql/schema/descriptions.go @@ -155,5 +155,10 @@ Indicates as to whether or not this document has been deleted. ` versionFieldDescription string = ` Returns the head commit for this document. +` + + encryptArgDescription string = ` +Encrypt flag specified if the input document(s) needs to be encrypted. If set, DefraDB will generate a +symmetric key for encryption using AES-GCM. ` ) diff --git a/internal/request/graphql/schema/generate.go b/internal/request/graphql/schema/generate.go index 12fe1860dd..27c9500b16 100644 --- a/internal/request/graphql/schema/generate.go +++ b/internal/request/graphql/schema/generate.go @@ -1039,7 +1039,6 @@ func (g *Generator) GenerateMutationInputForGQLType(obj *gql.Object) ([]*gql.Fie filterInputName := genTypeName(obj, filterInputNameSuffix) mutationInputName := genTypeName(obj, mutationInputNameSuffix) - mutationInputsName := genTypeName(obj, mutationInputsNameSuffix) filterInput, ok := g.manager.schema.TypeMap()[filterInputName].(*gql.InputObject) if !ok { @@ -1051,19 +1050,14 @@ func (g *Generator) GenerateMutationInputForGQLType(obj *gql.Object) ([]*gql.Fie return nil, NewErrTypeNotFound(mutationInputName) } - mutationInputs, ok := g.manager.schema.TypeMap()[mutationInputsName] - if !ok { - return nil, NewErrTypeNotFound(mutationInputsName) - } - create := &gql.Field{ Name: "create_" + obj.Name(), Description: createDocumentDescription, Type: obj, Args: gql.FieldConfigArgument{ "input": schemaTypes.NewArgConfig(mutationInput, "Create field values"), - "inputs": schemaTypes.NewArgConfig(mutationInputs, "Create field values"), - "encrypt": schemaTypes.NewArgConfig(gql.Boolean, "Encrypt input document(s)"), + "inputs": schemaTypes.NewArgConfig(gql.NewList(mutationInput), "Create field values"), + "encrypt": schemaTypes.NewArgConfig(gql.Boolean, encryptArgDescription), }, } diff --git a/tests/integration/utils2.go b/tests/integration/utils2.go index 29c23534dc..affbd02dc3 100644 --- a/tests/integration/utils2.go +++ b/tests/integration/utils2.go @@ -1312,8 +1312,6 @@ func createDocViaGQL( } require.NoError(s.t, err) - var docs []*client.Document - params := paramName + ": " + input if action.IsEncrypted { @@ -1347,7 +1345,9 @@ func createDocViaGQL( return nil, nil } - for _, docMap := range resultantDocs { + docs := make([]*client.Document, len(resultantDocs)) + + for i, docMap := range resultantDocs { docIDString := docMap["_docID"].(string) docID, err := client.NewDocIDFromString(docIDString) require.NoError(s.t, err) @@ -1355,7 +1355,7 @@ func createDocViaGQL( doc, err := collection.Get(ctx, docID, false) require.NoError(s.t, err) - docs = append(docs, doc) + docs[i] = doc } return docs, nil