prismake / typegql

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

How to use mutation with array? #69

Open SergeEsmanovich opened 4 years ago

SergeEsmanovich commented 4 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[])