From 4da2042e108fcaad86331f2d6ee05140c29d41a0 Mon Sep 17 00:00:00 2001 From: Andras Toth Date: Wed, 16 Dec 2015 10:00:28 +0100 Subject: [PATCH] fix(type): fix connections for different models with the same field names --- src/type/type.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/type/type.js b/src/type/type.js index 44c0d4f..c27350a 100644 --- a/src/type/type.js +++ b/src/type/type.js @@ -266,7 +266,8 @@ function getTypes(graffitiModels) { const typeFields = reduce(fields, (typeFields, field, fieldName) => { if (field.args === connectionArgs) { // It's a connection - const {connectionType} = connectionDefinitions({name: fieldName, nodeType: types[field.type], connectionFields: { + const fieldNameCapitalized = fieldName.charAt(0).toUpperCase() + fieldName.slice(1); + const {connectionType} = connectionDefinitions({name: `${typeName}${fieldNameCapitalized}`, nodeType: types[field.type], connectionFields: { count: { name: 'count', type: GraphQLFloat