Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Documenting Graphql schema using Nestjs Code-first approach

Is there a way to add comments to mutations and queries of your schema generated through code first approach of Nestjs?

like image 257
Huzaifa Ali Avatar asked Sep 06 '25 07:09

Huzaifa Ali


1 Answers

When using the decorators like @Field, @ObjectType and some others

You can use description : 'some comment'

And then you Will see the comments in graphql playground

Example

@ObjectType( {description : 'My class') )
Class Person {
    @Field ( () => ID, { description : ' ID of the user' } ) 
    Id: number
}
like image 116
Josesalasni Avatar answered Sep 07 '25 22:09

Josesalasni