Repository: smallrye/smallrye-graphql
Issue: Issue with GraphQLClientApi Mutation

I have a simple GraphQL server and a Kotlin client as follows:


```
@ApplicationScoped
class PeopleService(
    @ConfigProperty(name = "people.graphql.url")
    private val peopleApiUrl: String
) {

    var peopleApi: PeopleApi = GraphQlClientBuilder.newBuilder()
        .endpoint(peopleApiUrl)
        .build(PeopleApi::class.java)

    fun getPerson(ssn: String): Person = peopleApi.person(ssn)
    fun createPerson(person: PeopleApi.PersonData): PeopleApi.PersonData = peopleApi.createPerson(person)
}

@GraphQlClientApi
interface PeopleApi {
    @Query
    fun person(
        @Name("id") id: String,
    ): Person

    @Mutation(value = "createPerson")
    fun createPerson(
        @Name("personDetails")
        personDetails: PersonData
    ): PersonData

    @Input
    data class PersonData(
        var firstNames: String,
        var lastName: String,
    )
}
```
The server works when using the graphql-ui with the mutation:
```
mutation addKalle {
  createPerson(personDetails: {
    firstNames: "Kalervo", 
    lastName: "Jankko"
  }) {
    firstNames
    lastName
  }
}
```
But my Kotlin client does not send the same mutation. This is what comes to the server log:

```
2021-02-24 20:12:36,859 DEBUG [not.gra.GraphQL] (vert.x-worker-thread-15) Executing request. operation name: 'createPerson'. query: 'mutation createPerson($personDetails: ) { createPerson(personDetails: $personDetails) {firstNames lastName} }'. variables '{personDetails={lastName=Jankko, firstNames=Kalervo}}'
2021-02-24 20:12:36,859 DEBUG [not.gra.GraphQL] (vert.x-worker-thread-15) Parsing query: 'mutation createPerson($personDetails: ) { createPerson(personDetails: $personDetails) {firstNames lastName} }'...
2021-02-24 20:12:36,860 WARN  [not.gra.GraphQL] (vert.x-worker-thread-15) Query failed to parse : 'mutation createPerson($personDetails: ) { createPerson(personDetails: $personDetails) {firstNames lastName} }'

```
Why the name createPerson is there twice?

When debugging the client I also noticed that in io.smallrye.graphql.client.typesafe.impl.QueryBuilder

```
   private String declare(ParameterInfo parameter) {
        return "$" + parameter.getName() + ": " + parameter.graphQlInputTypeName();
    }
```

graphQlInputTypeName is an empty string..

The query of my Kotlin client works fine against the server. How to make the mutation work?

Changed files:
client/implementation/src/test/java/test/unit/ParametersBehavior.java
client/implementation/src/main/java/io/smallrye/graphql/client/typesafe/impl/reflection/ParameterInfo.java

diff --git a/client/implementation/src/main/java/io/smallrye/graphql/client/typesafe/impl/reflection/ParameterInfo.java b/client/implementation/src/main/java/io/smallrye/graphql/client/typesafe/impl/reflection/ParameterInfo.java
index 33c705a2..6c3715bc 100644
--- a/client/implementation/src/main/java/io/smallrye/graphql/client/typesafe/impl/reflection/ParameterInfo.java
+++ b/client/implementation/src/main/java/io/smallrye/graphql/client/typesafe/impl/reflection/ParameterInfo.java
@@ -44,8 +44,12 @@ public class ParameterInfo {
     }
 
     private String graphQlInputTypeName(TypeInfo type) {
-        if (type.isAnnotated(Input.class))
-            return type.getAnnotation(Input.class).value();
+        if (type.isAnnotated(Input.class)) {
+            String value = type.getAnnotation(Input.class).value();
+            if (!value.isEmpty()) {
+                return value;
+            }
+        }
         if (type.isAnnotated(Name.class))
             return type.getAnnotation(Name.class).value();
         switch (type.getSimpleName()) {
diff --git a/client/implementation/src/test/java/test/unit/ParametersBehavior.java b/client/implementation/src/test/java/test/unit/ParametersBehavior.java
index 3384ead7..9d65da18 100644
--- a/client/implementation/src/test/java/test/unit/ParametersBehavior.java
+++ b/client/implementation/src/test/java/test/unit/ParametersBehavior.java
@@ -202,6 +202,39 @@ class ParametersBehavior {
         then(greeting.count).isEqualTo(3);
     }
 
+    @GraphQlClientApi
+    interface EmptyInputObjectParamApi {
+        EmptyInputGreeting say(EmptyInputGreeting greet);
+    }
+
+    @Input
+    private static class EmptyInputGreeting {
+        String text;
+        int count;
+
+        @SuppressWarnings("unused")
+        EmptyInputGreeting() {
+        }
+
+        EmptyInputGreeting(String text, int count) {
+            this.text = text;
+            this.count = count;
+        }
+    }
+
+    @Test
+    void shouldCallEmptyInputObjectParamQuery() {
+        fixture.returnsData("'say':{'text':'ho','count':3}");
+        EmptyInputObjectParamApi api = fixture.build(EmptyInputObjectParamApi.class);
+
+        EmptyInputGreeting greeting = api.say(new EmptyInputGreeting("hi", 5));
+
+        then(fixture.query()).isEqualTo("query say($greet: EmptyInputGreetingInput) { say(greet: $greet) {text count} }");
+        then(fixture.variables()).isEqualTo("{'greet':{'text':'hi','count':5}}");
+        then(greeting.text).isEqualTo("ho");
+        then(greeting.count).isEqualTo(3);
+    }
+
     @GraphQlClientApi
     interface NamedTypeObjectParamApi {
         NamedTypeGreeting say(NamedTypeGreeting greet);