youshido-php/GraphQLBundle

Set description for documentation

PGBastien opened this issue · 4 comments

How can we set description to Queries , Types, Fields, ... ?

'price' => [
                'description' => 'This field contains price for Product',
                'type' => new StringType(),
                'args' => [
                    'currency' => new IntType(),
                ],
            ],

This options are working for type customization, but I still not find way for Queries documentation.

https://github.com/Youshido/GraphQL/blob/master/examples/02_blog/Schema/PostType.php

it's OK for Fields but i don't find for Queries and Types documentation.
Thks @Oleg-Anatolievich !

For Types, add function getDescription() to your AbstractObjectType

Example :

public function getDescription()
{
return 'Description of my Type';
}

The same for Queries, add function getDescription to your AbstractContainerAwareField

Example :

public function getDescription() { return "Get data from ..."; }