diff --git a/src/Type/Definition/DirectiveLocation.php b/src/Type/Definition/DirectiveLocation.php index e9ee7fa..fee4d7a 100644 --- a/src/Type/Definition/DirectiveLocation.php +++ b/src/Type/Definition/DirectiveLocation.php @@ -1,6 +1,9 @@ toArray(true) + * This is a reverse operation for AST::toArray($node) * + * @api * @param array $node * @return Node */ @@ -98,6 +98,7 @@ class AST /** * Convert AST node to serializable array * + * @api * @param Node $node * @return array */ @@ -124,6 +125,7 @@ class AST * | Mixed | Enum Value | * | null | NullValue | * + * @api * @param $value * @param InputType $type * @return ObjectValueNode|ListValueNode|BooleanValueNode|IntValueNode|FloatValueNode|EnumValueNode|StringValueNode|NullValueNode @@ -267,8 +269,9 @@ class AST * | String | String | * | Int / Float | Int / Float | * | Enum Value | Mixed | - * | Null Value | stdClass | instance of NullValue::getNullValue() + * | Null Value | null | * + * @api * @param $valueNode * @param InputType $type * @param null $variables @@ -396,6 +399,9 @@ class AST } /** + * Returns type definition for given AST Type node + * + * @api * @param Schema $schema * @param NamedTypeNode|ListTypeNode|NonNullTypeNode $inputTypeNode * @return Type @@ -430,6 +436,9 @@ class AST } /** + * Returns operation type ("query", "mutation" or "subscription") given a document and operation name + * + * @api * @param DocumentNode $document * @param string $operationName * @return bool diff --git a/src/Utils/BuildSchema.php b/src/Utils/BuildSchema.php index 413fc0e..6ebd6c9 100644 --- a/src/Utils/BuildSchema.php +++ b/src/Utils/BuildSchema.php @@ -33,8 +33,8 @@ use GraphQL\Type\Definition\UnionType; use GraphQL\Type\Introspection; /** - * Class BuildSchema - * @package GraphQL\Utils + * Build instance of `GraphQL\Type\Schema` out of type language definition (string or parsed AST) + * See [section in docs](type-system/type-language.md) for details. */ class BuildSchema { @@ -72,9 +72,10 @@ class BuildSchema * If no schema definition is provided, then it will look for types named Query * and Mutation. * - * Given that AST it constructs a GraphQLSchema. The resulting schema + * Given that AST it constructs a GraphQL\Type\Schema. The resulting schema * has no resolve methods, so execution will use default resolvers. * + * @api * @param DocumentNode $ast * @param callable $typeConfigDecorator * @return Schema @@ -608,6 +609,7 @@ class BuildSchema * A helper function to build a GraphQLSchema directly from a source * document. * + * @api * @param DocumentNode|Source|string $source * @param callable $typeConfigDecorator * @return Schema diff --git a/src/Utils/SchemaPrinter.php b/src/Utils/SchemaPrinter.php index 435d112..1e1d9cb 100644 --- a/src/Utils/SchemaPrinter.php +++ b/src/Utils/SchemaPrinter.php @@ -14,11 +14,15 @@ use GraphQL\Type\Definition\UnionType; use GraphQL\Type\Definition\Directive; /** - * Class SchemaPrinter - * @package GraphQL\Utils + * Given an instance of Schema, prints it in GraphQL type language. */ class SchemaPrinter { + /** + * @api + * @param Schema $schema + * @return string + */ public static function doPrint(Schema $schema) { return self::printFilteredSchema($schema, function($n) { @@ -26,6 +30,11 @@ class SchemaPrinter }, 'self::isDefinedType'); } + /** + * @api + * @param Schema $schema + * @return string + */ public static function printIntrosepctionSchema(Schema $schema) { return self::printFilteredSchema($schema, [__CLASS__, 'isSpecDirective'], [__CLASS__, 'isIntrospectionType']); diff --git a/tools/gendocs.php b/tools/gendocs.php index c293ed0..7a2d16c 100644 --- a/tools/gendocs.php +++ b/tools/gendocs.php @@ -8,6 +8,8 @@ $outputFile = __DIR__ . '/../docs/reference.md'; $entries = [ \GraphQL\GraphQL::class, \GraphQL\Type\Definition\Type::class, + \GraphQL\Type\Definition\ResolveInfo::class, + \GraphQL\Type\Definition\DirectiveLocation::class => ['constants' => true], \GraphQL\Type\SchemaConfig::class, \GraphQL\Type\Schema::class, \GraphQL\Language\Parser::class, @@ -17,7 +19,6 @@ $entries = [ \GraphQL\Executor\Executor::class, \GraphQL\Executor\ExecutionResult::class, \GraphQL\Executor\Promise\PromiseAdapter::class, - \GraphQL\Type\Definition\ResolveInfo::class, \GraphQL\Validator\DocumentValidator::class, \GraphQL\Error\Error::class => ['constants' => true, 'methods' => true, 'props' => true], \GraphQL\Error\Warning::class => ['constants' => true, 'methods' => true], @@ -27,7 +28,10 @@ $entries = [ \GraphQL\Server\StandardServer::class, \GraphQL\Server\ServerConfig::class, \GraphQL\Server\Helper::class, - \GraphQL\Server\OperationParams::class + \GraphQL\Server\OperationParams::class, + \GraphQL\Utils\BuildSchema::class, + \GraphQL\Utils\AST::class, + \GraphQL\Utils\SchemaPrinter::class ]; function renderClassMethod(ReflectionMethod $method) {