youshido-php / GraphQLBundle

Pure PHP implementation of GraphQL Server – Symfony Bundle
MIT License
284 stars 44 forks source link

Set description for documentation #57

Open PGBastien opened 7 years ago

PGBastien commented 7 years ago

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

oskalo commented 7 years ago
'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

PGBastien commented 7 years ago

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

PGBastien commented 7 years ago

For Types, add function getDescription() to your AbstractObjectType

Example :

public function getDescription()
{
return 'Description of my Type';
}
PGBastien commented 7 years ago

The same for Queries, add function getDescription to your AbstractContainerAwareField

Example :

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