smallrye-graphql icon indicating copy to clipboard operation
smallrye-graphql copied to clipboard

@Type's do not support arguments

Open wishfoundry opened this issue 4 years ago • 2 comments

smallrye supports arguments on top level query fields, but not on Types:

type Query {
  parent: Nested                            #supported
  parentWithArgs(with: String): Nested      #supported
}

type Nested {
  doThing: [String]!                        #supported
  doThingWithArgs(with: String): [String]!  #not supported
}

graphql should support arguments on any level of nested types

wishfoundry avatar Dec 23 '20 16:12 wishfoundry

Hi @wishfoundry .

You can use @Source to add a field like that.

(see https://download.eclipse.org/microprofile/microprofile-graphql-1.0.3/microprofile-graphql.html#fields)

Something like this:

@GraphQLApi
public class MyQueries {

   @Query
   public Nested getParent(){
      // ...
   }

    public String doThingWithArgs(@Source Nested nested, String with) {
        // ...
    }
}

public class Nested {
    private String doThing;
}

phillip-kruger avatar Jan 07 '21 07:01 phillip-kruger

I think that it sometimes may be more convenient to add the parameterized field directly to the Type. IMHO we should keep this feature request open.

t1 avatar Jan 07 '21 18:01 t1