mirror of
https://github.com/retailcrm/graphql-php.git
synced 2025-02-06 07:49:24 +03:00
Updated AST to 2016 spec version
This commit is contained in:
parent
c053169671
commit
86adfde0a0
@ -6,5 +6,6 @@ interface Definition
|
||||
/**
|
||||
* export type Definition = OperationDefinition
|
||||
* | FragmentDefinition
|
||||
* | TypeSystemDefinition // experimental non-spec addition.
|
||||
*/
|
||||
}
|
||||
|
25
src/Language/AST/DirectiveDefinition.php
Normal file
25
src/Language/AST/DirectiveDefinition.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace GraphQL\Language\AST;
|
||||
|
||||
class DirectiveDefinition extends Node implements TypeSystemDefinition
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $kind = Node::DIRECTIVE_DEFINITION;
|
||||
|
||||
/**
|
||||
* @var Name
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var Argument[]
|
||||
*/
|
||||
public $arguments;
|
||||
|
||||
/**
|
||||
* @var Name[]
|
||||
*/
|
||||
public $locations;
|
||||
}
|
20
src/Language/AST/EnumTypeDefinition.php
Normal file
20
src/Language/AST/EnumTypeDefinition.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
namespace GraphQL\Language\AST;
|
||||
|
||||
class EnumTypeDefinition extends Node implements TypeDefinition
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $kind = self::UNION_TYPE_DEFINITION;
|
||||
|
||||
/**
|
||||
* @var Name
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var EnumValueDefinition[]
|
||||
*/
|
||||
public $values;
|
||||
}
|
15
src/Language/AST/EnumValueDefinition.php
Normal file
15
src/Language/AST/EnumValueDefinition.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
namespace GraphQL\Language\AST;
|
||||
|
||||
class EnumValueDefinition extends Node
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $kind = Node::ENUM_VALUE_DEFINITION;
|
||||
|
||||
/**
|
||||
* @var Name
|
||||
*/
|
||||
public $name;
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace GraphQL\Language\AST;
|
||||
|
||||
class Field extends Node
|
||||
class Field extends Node implements Selection
|
||||
{
|
||||
public $kind = Node::FIELD;
|
||||
|
||||
|
25
src/Language/AST/FieldDefinition.php
Normal file
25
src/Language/AST/FieldDefinition.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace GraphQL\Language\AST;
|
||||
|
||||
class FieldDefinition extends Node
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $kind = Node::FIELD_DEFINITION;
|
||||
|
||||
/**
|
||||
* @var Name
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var InputValueDefinition[]
|
||||
*/
|
||||
public $arguments;
|
||||
|
||||
/**
|
||||
* @var Type
|
||||
*/
|
||||
public $type;
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace GraphQL\Language\AST;
|
||||
|
||||
class FragmentSpread extends Node
|
||||
class FragmentSpread extends Node implements Selection
|
||||
{
|
||||
public $kind = Node::FRAGMENT_SPREAD;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace GraphQL\Language\AST;
|
||||
|
||||
class InlineFragment extends Node
|
||||
class InlineFragment extends Node implements Selection
|
||||
{
|
||||
public $kind = Node::INLINE_FRAGMENT;
|
||||
|
||||
|
20
src/Language/AST/InputObjectTypeDefinition.php
Normal file
20
src/Language/AST/InputObjectTypeDefinition.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
namespace GraphQL\Language\AST;
|
||||
|
||||
class InputObjectTypeDefinition extends Node implements TypeDefinition
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $kind = Node::INPUT_OBJECT_TYPE_DEFINITION;
|
||||
|
||||
/**
|
||||
* @var Name
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var InputValueDefinition[]
|
||||
*/
|
||||
public $fields;
|
||||
}
|
25
src/Language/AST/InputValueDefinition.php
Normal file
25
src/Language/AST/InputValueDefinition.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace GraphQL\Language\AST;
|
||||
|
||||
class InputValueDefinition extends Node
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $kind = Node::INPUT_VALUE_DEFINITION;
|
||||
|
||||
/**
|
||||
* @var Name
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var Type
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* @var Value
|
||||
*/
|
||||
public $defaultValue;
|
||||
}
|
20
src/Language/AST/InterfaceTypeDefinition.php
Normal file
20
src/Language/AST/InterfaceTypeDefinition.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
namespace GraphQL\Language\AST;
|
||||
|
||||
class InterfaceTypeDefinition extends Node implements TypeDefinition
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $kind = Node::INTERFACE_TYPE_DEFINITION;
|
||||
|
||||
/**
|
||||
* @var Name
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var FieldDefinition[]
|
||||
*/
|
||||
public $fields = [];
|
||||
}
|
@ -46,7 +46,31 @@ abstract class Node
|
||||
const LIST_TYPE = 'ListType';
|
||||
const NON_NULL_TYPE = 'NonNullType';
|
||||
|
||||
|
||||
// Type System Definitions
|
||||
|
||||
const SCHEMA_DEFINITION = 'SchemaDefinition';
|
||||
const OPERATION_TYPE_DEFINITION = 'OperationTypeDefinition';
|
||||
|
||||
// Type Definitions
|
||||
|
||||
const SCALAR_TYPE_DEFINITION = 'ScalarTypeDefinition';
|
||||
const OBJECT_TYPE_DEFINITION = 'ObjectTypeDefinition';
|
||||
const FIELD_DEFINITION = 'FieldDefinition';
|
||||
const INPUT_VALUE_DEFINITION = 'InputValueDefinition';
|
||||
const INTERFACE_TYPE_DEFINITION = 'InterfaceTypeDefinition';
|
||||
const UNION_TYPE_DEFINITION = 'UnionTypeDefinition';
|
||||
const ENUM_TYPE_DEFINITION = 'EnumTypeDefinition';
|
||||
const ENUM_VALUE_DEFINITION = 'EnumValueDefinition';
|
||||
const INPUT_OBJECT_TYPE_DEFINITION = 'InputObjectTypeDefinition';
|
||||
|
||||
// Type Extensions
|
||||
|
||||
const TYPE_EXTENSION_DEFINITION = 'TypeExtensionDefinition';
|
||||
|
||||
// Directive Definitions
|
||||
|
||||
const DIRECTIVE_DEFINITION = 'DirectiveDefinition';
|
||||
|
||||
/**
|
||||
type Node = Name
|
||||
| Document
|
||||
|
25
src/Language/AST/ObjectTypeDefinition.php
Normal file
25
src/Language/AST/ObjectTypeDefinition.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace GraphQL\Language\AST;
|
||||
|
||||
class ObjectTypeDefinition extends Node implements TypeDefinition
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $kind = Node::OBJECT_TYPE_DEFINITION;
|
||||
|
||||
/**
|
||||
* @var Name
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var NamedType[]
|
||||
*/
|
||||
public $interfaces = [];
|
||||
|
||||
/**
|
||||
* @var FieldDefinition[]
|
||||
*/
|
||||
public $fields;
|
||||
}
|
22
src/Language/AST/OperationTypeDefinition.php
Normal file
22
src/Language/AST/OperationTypeDefinition.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
namespace GraphQL\Language\AST;
|
||||
|
||||
class OperationTypeDefinition extends Node
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $kind = Node::OPERATION_TYPE_DEFINITION;
|
||||
|
||||
/**
|
||||
* One of 'query' | 'mutation' | 'subscription'
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $operation;
|
||||
|
||||
/**
|
||||
* @var NamedType
|
||||
*/
|
||||
public $type;
|
||||
}
|
13
src/Language/AST/ScalarTypeDefinition.php
Normal file
13
src/Language/AST/ScalarTypeDefinition.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
namespace GraphQL\Language\AST;
|
||||
|
||||
|
||||
class ScalarTypeDefinition extends Node implements TypeDefinition
|
||||
{
|
||||
public $kind = Node::SCALAR_TYPE_DEFINITION;
|
||||
|
||||
/**
|
||||
* @var Name
|
||||
*/
|
||||
public $name;
|
||||
}
|
15
src/Language/AST/SchemaDefinition.php
Normal file
15
src/Language/AST/SchemaDefinition.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
namespace GraphQL\Language\AST;
|
||||
|
||||
class SchemaDefinition extends Node implements TypeSystemDefinition
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $kind = Node::SCHEMA_DEFINITION;
|
||||
|
||||
/**
|
||||
* @var OperationTypeDefinition[]
|
||||
*/
|
||||
public $operationTypes;
|
||||
}
|
14
src/Language/AST/TypeDefinition.php
Normal file
14
src/Language/AST/TypeDefinition.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
namespace GraphQL\Language\AST;
|
||||
|
||||
interface TypeDefinition extends TypeSystemDefinition
|
||||
{
|
||||
/**
|
||||
export type TypeDefinition = ScalarTypeDefinition
|
||||
| ObjectTypeDefinition
|
||||
| InterfaceTypeDefinition
|
||||
| UnionTypeDefinition
|
||||
| EnumTypeDefinition
|
||||
| InputObjectTypeDefinition
|
||||
*/
|
||||
}
|
15
src/Language/AST/TypeExtensionDefinition.php
Normal file
15
src/Language/AST/TypeExtensionDefinition.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
namespace GraphQL\Language\AST;
|
||||
|
||||
class TypeExtensionDefinition extends Node implements TypeSystemDefinition
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $kind = Node::TYPE_EXTENSION_DEFINITION;
|
||||
|
||||
/**
|
||||
* @var ObjectTypeDefinition
|
||||
*/
|
||||
public $definition;
|
||||
}
|
12
src/Language/AST/TypeSystemDefinition.php
Normal file
12
src/Language/AST/TypeSystemDefinition.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
namespace GraphQL\Language\AST;
|
||||
|
||||
interface TypeSystemDefinition extends Definition
|
||||
{
|
||||
/**
|
||||
export type TypeSystemDefinition = SchemaDefinition
|
||||
| TypeDefinition
|
||||
| TypeExtensionDefinition
|
||||
| DirectiveDefinition
|
||||
*/
|
||||
}
|
20
src/Language/AST/UnionTypeDefinition.php
Normal file
20
src/Language/AST/UnionTypeDefinition.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
namespace GraphQL\Language\AST;
|
||||
|
||||
class UnionTypeDefinition extends Node implements TypeDefinition
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $kind = self::UNION_TYPE_DEFINITION;
|
||||
|
||||
/**
|
||||
* @var Name
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var NamedType[]
|
||||
*/
|
||||
public $types = [];
|
||||
}
|
@ -20,7 +20,6 @@ class Token
|
||||
const PIPE = 13;
|
||||
const BRACE_R = 14;
|
||||
const NAME = 15;
|
||||
const VARIABLE = 16;
|
||||
const INT = 17;
|
||||
const FLOAT = 18;
|
||||
const STRING = 19;
|
||||
@ -43,7 +42,6 @@ class Token
|
||||
$description[self::PIPE] = '|';
|
||||
$description[self::BRACE_R] = '}';
|
||||
$description[self::NAME] = 'Name';
|
||||
$description[self::VARIABLE] = 'Variable';
|
||||
$description[self::INT] = 'Int';
|
||||
$description[self::FLOAT] = 'Float';
|
||||
$description[self::STRING] = 'String';
|
||||
|
Loading…
x
Reference in New Issue
Block a user