Skip to content

Commit 7ebf86d

Browse files
committed
feat: GeneratedMapper: prefix name of InputObject to the "buildByMap" method
1 parent 93ee844 commit 7ebf86d

File tree

1 file changed

+11
-2
lines changed
  • graphql-kotlin-toolkit-codegen/src/main/kotlin/com/auritylab/graphql/kotlin/toolkit/codegen/mapper

1 file changed

+11
-2
lines changed

graphql-kotlin-toolkit-codegen/src/main/kotlin/com/auritylab/graphql/kotlin/toolkit/codegen/mapper/GeneratedMapper.kt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.auritylab.graphql.kotlin.toolkit.codegen.mapper
22

33
import com.auritylab.graphql.kotlin.toolkit.codegen.CodegenOptions
44
import com.auritylab.graphql.kotlin.toolkit.codegen.helper.NamingHelper
5+
import com.auritylab.graphql.kotlin.toolkit.codegen.helper.lowercaseFirst
56
import com.squareup.kotlinpoet.ClassName
67
import com.squareup.kotlinpoet.MemberName
78
import graphql.schema.GraphQLEnumType
@@ -57,8 +58,16 @@ internal class GeneratedMapper(
5758
/**
5859
* Will return the [MemberName] of the builder method for the given [inputObject].
5960
*/
60-
fun getInputObjectBuilderMemberName(inputObject: GraphQLInputObjectType): MemberName =
61-
MemberName(getGeneratedTypeClassName(inputObject).addSimpleNames("Companion"), "buildByMap")
61+
fun getInputObjectBuilderMemberName(inputObject: GraphQLInputObjectType): MemberName {
62+
val uppercaseInputObject = inputObject.name.lowercaseFirst()
63+
val joinedMethodNamed = uppercaseInputObject + "BuildByMap"
64+
65+
// Build the MemberName for with the joined method name as actual method name.
66+
return MemberName(
67+
getGeneratedTypeClassName(inputObject).addSimpleNames("Companion"),
68+
joinedMethodNamed
69+
)
70+
}
6271

6372
/**
6473
* Will return the [MemberName] which points to a string which contains the name of the container for the given field resolver.

0 commit comments

Comments
 (0)