you can add a description option to the code first decorators @Query, @Mutation, @ObjectType, @Field and more.
Here is an example how to add a description:
@ObjectType({description:'Authentication Payload'})exportclassAuth{@Field({description:'JWT Bearer Token for Authentication'})token:string;....}
This documentation is added to the generated graphql schema as comment """DESCRIPTION""" to the field or query, this is getting picked up by the graphql playground.
The recipe seems to work, just tried it in NestJS 7. Apollo's GraphQL Playground doesn't make descriptions quite visible though. But they are there (the "DOCS" tab).
The set of supported markups is yet to be discovered. Markdown's code seems to work, don't know about the rest.
Hi Alex,
you can add a
description
option to the code first decorators@Query
,@Mutation
,@ObjectType
,@Field
and more.Here is an example how to add a description:
This documentation is added to the generated graphql schema as comment
"""DESCRIPTION"""
to the field or query, this is getting picked up by the graphql playground.Let me know if this helps you.
Hey Marc,
Thank you for the info.
The recipe seems to work, just tried it in NestJS 7. Apollo's GraphQL Playground doesn't make descriptions quite visible though. But they are there (the "DOCS" tab).
The set of supported markups is yet to be discovered. Markdown's
code
seems to work, don't know about the rest.Cheers!
Good idea to add markdown to the docs that helps too.
I am glad I could help :)