Changed
- PHP version required: 7.4+
- Propagate error message and stack trace for why leaf value serialization failed
- Do not throw client safe
Error
when failing to serialize an Enum type - Use native PHP types for properties of
Type
and its subclasses - Throw
SerializationError
over client safeError
when failing to serialize leaf types - Move debug entries in errors under
extensions
key - Use native PHP types wherever possible
- Always throw
RequestError
with useful message when clients provide an invalid JSON body - Move class
BlockString
from namespaceGraphQL\Utils
toGraphQL\Language
- Return string-keyed arrays from
GraphQL::getStandardDirectives()
,GraphQL::getStandardTypes()
andGraphQL::getStandardValidationRules()
- Move complexity related code from
FieldDefinition
toQueryComplexity
- Exclude unused standard types from the schema
- Require lazy type loader to return
Type
directly without an intermediary callable - Allow lazy type loader to return
null
- Rename
ServerConfig
optionpersistentQueryLoader
topersistedQueryLoader
- Call previously unused methods
EnumType::parseValue()
andEnumType::parseLiteral()
- Strongly type
PromiseAdapter::createRejected()
to require\Throwable
- Move members specific to
NamedType
out ofType
:$name
,$description
,$config
,isBuiltInType()
,assertValid()
- Always convert recursively when calling
Node::toArray()
- Make
Directive::$config['args']
use the same definition style asFieldDefinition::$config['args']
- Rename
FieldArgument
toArgument
- Make errors when parsing scalar literals more precise
- Change expected
QueryPlan
options from['group-implementor-fields']
to['groupImplementorFields' => true]
inResolveInfo::lookAhead()
- Always convert promises through
PromiseAdapter::convertThenable()
before calling->then()
on them - Use
JSON_THROW_ON_ERROR
injson_encode()
- Validate some internal invariants through
assert()
PromiseAdapter::all()
acceptsiterable
- Throw if
Introspection::fromSchema()
returns no data - Reorganize abstract class
ASTValidationContext
to interfaceValidationContext
- Reorganize AST interfaces related to schema and type extensions
- Align
Utils::suggestionList()
with the reference implementation (#1075) - Order schema topologically and according to the user-defined order, affects introspection and printing
GraphQL\Utils\AST::typeFromAST()
now needs a type loader callable instead of the Schema- Do not change HTTP status code in
StandardServer
- Use
"
instead of"""
for single line descriptions - Make
Helper::emitResponse()
private, useHelper::sendResponse()
- Emit unescaped UTF-8 from
StandardServer
- Sync input value coercion with
graphql-js
reference implementation
Added
- Improve extendability of validator rules
- Add tests for errors that occur when undeclared fields are passed in input
- Warn about orphaned object types
- Expose structured enumeration of directive locations
- Add
AST::concatAST()
utility - Allow lazy input object fields
- Add validation rule
UniqueEnumValueNames
- Add SDL validation rule
UniqueOperationTypes
(#995) - Add ability to remove custom validation rules after adding them via
DocumentValidator::removeRule()
- Allow lazy enum values
- Make
Node
implementJsonSerializable
- Add SDL validation rule
UniqueTypeNames
(#998) - Add support for SDL validation to
KnownTypeNames
rule (#999) - Add SDL validation rule
UniqueArgumentDefinitionNames
(#1136) - Add
parseValue
config option to InputObjectType to parse input value to custom value object - Add option
sortTypes
to haveSchemaPrinter
order types alphabetically - Allow constructing
EnumType
from PHP enum - Add
TypeInfo::getParentTypeStack()
andTypeInfo::getFieldDefStack()
- Include path to faulty input in coercion errors
Optimized
- Use recursive algorithm for printer and improve its performance
- Use
foreach
over slower functionsarray_map()
andUtils::map()
Fixed
- Avoid QueryPlan crash when multiple $fieldNodes are present
- Clarify error when attempting to coerce anything but
array
orstdClass
to an input object - Allow directives on variable definitions
- Handle
null
parent of list inValuesOfCorrectType::getVisitor
- Allow sending both
query
andqueryId
, ignorequeryId
in that case - Preserve extended methods from class-based types in
SchemaExtender::extend()
- Fix printing of empty types (#940)
- Clone
NodeList
inNode::cloneDeep()
- Calling
Schema::getType()
on a schema built from SDL returnsnull
for unknown types (#1068) - Avoid crash on typeless inline fragment when using
QueryComplexity
rule - Avoid calling
FormattedError::addDebugEntries()
twice when using default error formatting - Avoid calling defined functions named like lazily loaded types
- Show actual error in debug entries
Removed
- Remove deprecated
Type::getInternalTypes()
- Remove deprecated
GraphQL::execute()
- Remove deprecated
GraphQL::executeAndReturnResult()
- Remove deprecated experimental CoroutineExecutor
- Remove deprecated
FormattedError::create()
andFormattedError::createFromPHPError()
- Remove deprecated
GraphQL::setPromiseAdapter()
- Remove deprecated
AST::getOperation()
- Remove deprecated constants from
BreakingChangesFinder
- Remove deprecated
DocumentValidator::isValidLiteralValue()
- Remove deprecated
Error::formatError()
andError::toSerializableArray()
- Remove deprecated
GraphQL::getInternalDirectives()
- Remove deprecated
Schema::isPossibleType()
- Remove deprecated methods from
TypeInfo
- Remove deprecated
Values::valueFromAST()
andValues::isValidPHPValue()
- Remove deprecated public property access to
InputObjectField::$type
- Remove deprecated public property access to
FieldDefinition::$type
- Remove alias
GraphQL\Validator\Rules\AbstractQuerySecurity
, useGraphQL\Validator\Rules\QuerySecurityRule
- Remove alias
GraphQL\Validator\Rules\AbstractValidationRule
, useGraphQL\Validator\Rules\ValidationRule
- Remove alias
GraphQL\Utils\FindBreakingChanges
, useGraphQL\Utils\BreakingChangesFinder
- Remove
OperationParams
methodgetOriginalInput()
in favor of public property$originalInput
- Remove
OperationParams
methodisReadOnly()
in favor of public property$readOnly
- Remove
Utils::withErrorHandling()
- Remove
TypeComparators::doTypesOverlap()
- Remove
DocumentValidator::isError()
- Remove
DocumentValidator::append()
- Remove
Utils::getVariableType()
in favor ofUtils::printSafe()
- Remove warning for passing
isDeprecated
in field definition config - Remove
WrappingType::getWrappedType()
argument$recurse
in favor ofWrappingType::getInnermostType()
- Remove
Type::assertType()
- Remove
ListOfType::$ofType
,ListOfType::getOfType()
andNonNull::getOfType()
- Remove option
commentDescriptions
fromBuildSchema::buildAST()
,BuildSchema::build()
andPrinter::doPrint()
- Remove parameter
$options
fromASTDefinitionBuilder
- Remove
FieldDefinition::create()
in favor ofnew FieldDefinition()
- Remove
GraphQL\Exception\InvalidArgument
- Remove
Utils::find()
,Utils::every()
andUtils::invariant()
- Remove argument
bool $exitWhenDone
fromStandardServer::send500Error()
andStandardServer::handleRequest()
- Remove
Schema::getAstNode()
in favor ofSchema::$astNode
- Remove ability to override standard types through
Schema
optiontypes
, useType::overrideStandardTypes()
- Remove
GraphQL\Utils\TypeInfo::typeFromAST()
, useGraphQL\Utils\AST::typeFromAST()
- Remove
StandardServer::send500Error()
, handle non-GraphQL errors yourself - Remove
StandardServer::getHelper()
, usenew Helper