prismake / typegql

Create GraphQL schema with TypeScript classes.
https://prismake.github.io/typegql/
MIT License
424 stars 21 forks source link

How to use mutation with array? #69

Open SergeEsmanovich opened 5 years ago

SergeEsmanovich commented 5 years ago

I try

  @Mutation({type: Number, description: ''})
    public async addSkillsSwToProfile(skillsSwInputDto: [SkillsSwInputDto]): Promise<number> {
        return 1;
    }

and getting Error: @Type SavageWorlds.addSkillsSwToProfile(skillsSwInputDto <-------): Could not infer type of argument. Make sure to use native GraphQLInputType, native scalar like 'String' or class decorated with @InputObjectType

graphqlmastery.com writes use GraphQLList

pie6k commented 4 years ago

Hey,

typegql is not able to automatically infer array types. You'd need to decorate your argument skillsSwInputDto like @Arg({type: [SkillsSwInputDto]}) skillsSwInputDto: SkillsSwInputDto[])