All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
You can find and compare releases at the GitHub release page.
- Handle fields that return lists in
ResolveInfo::getFieldSelectionWithAliaseswebonyx#1664
- Add method
getFieldSelectionWithAliasesto classResolveInfowebonyx#1648
- Reset static caches of instances using standard types when overriding them webonyx#1632
- Propagate error messages of client-safe exceptions during
parseValuewebonyx#1624
- Allow customizing PhpEnumType webonyx#1623
- Make field args mapper optional webonyx#1622
- Create field args mapper and cache args resolution webonyx#1587
- Add field config decorator when building schema from SDL webonyx#1590
- Serialize
BackedEnuminstances by name, not value webonyx#1618
- Annotate return value of
Helper::validateOperationParamsas list webonyx#1615
- Narrow type of execution errors from
arraytolistwebonyx#1597
- Allow native PHP enums as return values for SDL-based enums webonyx#1608
- Serialize valid
\BackedEnumvalues inGraphQL\Type\Definition\PhpEnumTypewebonyx#1604
- Avoid infinite recursion in
QueryDepthvalidator webonyx#1581
- Ensure
unaliasedPathdoes not grow for each list item webonyx#1579
- Avoid crash by triggering side effect via
countonPHPUnit\Framework\Testwebonyx#1577
- Optimize and deduplicate ReferenceExecutor webonyx#1572
- Remove redundant code in
ReferenceExecutorwebonyx#1570
- Add property
unaliasedPathtoResolveInfowebonyx#1548
- Fix
ScopedContextfor mutations webonyx#1549
- Count new lines when parsing multi-line comments webonyx#1538
- Allow scalars from
BuildClientSchemato have any type webonyx#1536
- The standard server now produces distinct exception classes instead of generic
RequestErrorwebonyx#1533
- Allow enum instances in
PhpEnumType::parseValue()webonyx#1519
- Support
react/promisev3 webonyx#1517
- Correctly print deprecated argument with default value webonyx#1491
- Early return when complexity is disabled webonyx#1475
- Allow access to calculated query complexity webonyx#1475
- Fix PHPStan definition for
SchemaConfigoptiontypeswebonyx#1479
- Control field visibility through option
visiblewebonyx#1434
- Fix printing of single line descriptions with Unicode webonyx#1436
- Avoid instantiations when checking if types are built-in webonyx#1423
- Allow lazy root type callables to return
nullwebonyx#1422
- Allow lazy root types
query,mutation,subscriptionwebonyx#1418
- Also set
queryIdfrom Apollo-sourcesha256Hashifqueryis provided webonyx#1412
- Do not set raw vars on query complexity rule if no validation rules are used webonyx#1413
- Remove useless and broken
Parser::document(), useparse()
- Add
ScopedContextinterface to control cloning of the context value
- Allow deprecating input fields and arguments webonyx#1382
- Call static methods in
SchemaPrinterwithstatic::to enable overrides
- Allow sending both
queryandqueryId, letpersistedQueryLoaderhandle it webonyx#1372
- Provide a custom name for the Enum generated by
PhpEnumTypewebonyx#1368
- Merge selected fields in
ResolveInfo::getFieldSelection()webonyx#1365
- Ensure
OperationDefinitionNode.variableDefinitionsis initialized
- Annotate
@throwsaccurately
- Improve handling of JSON encoding errors
- Initialize
directivesandargumentsinNodewith emptyNodeList
- Improve validation messages for type definitions
- Add additional sorting options to
SchemaPrinter
- Fix
QueryPlanforuniontypes
- Improve
QueryPlanperformance
- Fix
QueryPlanwhen querying__typenameon auniontype
- Fix printing of single line descriptions with backslashes
- Print long argument lists on multiple lines
- Print space between object value brackets
- PHP version required: 7.4+
- Propagate error message and stack trace for why leaf value serialization failed
- Do not throw client safe
Errorwhen failing to serialize an Enum type - Use native PHP types for properties of
Typeand its subclasses - Throw
SerializationErrorover client safeErrorwhen failing to serialize leaf types - Move debug entries in errors under
extensionskey - Use native PHP types wherever possible
- Always throw
RequestErrorwith useful message when clients provide an invalid JSON body - Move class
BlockStringfrom namespaceGraphQL\UtilstoGraphQL\Language - Return string-keyed arrays from
GraphQL::getStandardDirectives(),GraphQL::getStandardTypes()andGraphQL::getStandardValidationRules() - Move complexity related code from
FieldDefinitiontoQueryComplexity - Exclude unused standard types from the schema
- Require lazy type loader to return
Typedirectly without an intermediary callable - Allow lazy type loader to return
null - Rename
ServerConfigoptionpersistentQueryLoadertopersistedQueryLoader - Call previously unused methods
EnumType::parseValue()andEnumType::parseLiteral() - Strongly type
PromiseAdapter::createRejected()to require\Throwable - Move members specific to
NamedTypeout 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
FieldArgumenttoArgument - Make errors when parsing scalar literals more precise
- Change expected
QueryPlanoptions from['group-implementor-fields']to['groupImplementorFields' => true]inResolveInfo::lookAhead() - Always convert promises through
PromiseAdapter::convertThenable()before calling->then()on them - Use
JSON_THROW_ON_ERRORinjson_encode() - Validate some internal invariants through
assert() PromiseAdapter::all()acceptsiterable- Throw if
Introspection::fromSchema()returns no data - Reorganize abstract class
ASTValidationContextto 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-jsreference implementation - Store rules exclusively by class name in
DocumentValidator - Reorder standard types as described in the GraphQL specification
- Improve runtime performance by moving checks for duplicate/mismatching type instances to
assert()or schema validation - Replace
HasSelectionSet::$selectionSetwithHasSelectionSet::getSelectionSet() - Replace
TypeDefinitionNode::$namewithTypeDefinitionNode::getName() - Replace
TypeExtensionNode::$namewithTypeExtensionNode::getName()
- 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
NodeimplementJsonSerializable - Add SDL validation rule
UniqueTypeNames(#998) - Add support for SDL validation to
KnownTypeNamesrule (#999) - Add SDL validation rule
UniqueArgumentDefinitionNames(#1136) - Add
parseValueconfig option to InputObjectType to parse input value to custom value object - Add option
sortTypesto haveSchemaPrinterorder types alphabetically - Allow constructing
EnumTypefrom PHP enum - Add
TypeInfo::getParentTypeStack()andTypeInfo::getFieldDefStack() - Include path to faulty input in coercion errors
- Add ability to resolve abstract type of object via
__typename
- Use recursive algorithm for printer and improve its performance
- Use
foreachover slower functionsarray_map()andUtils::map()
- Avoid
QueryPlancrash when multiple$fieldNodesare present - Allow instantiating multiple
QueryPlanwith different options - Clarify error when attempting to coerce anything but
arrayorstdClassto an input object - Allow directives on variable definitions
- Handle
nullparent of list inValuesOfCorrectType::getVisitor - Allow sending both
queryandqueryId, ignorequeryIdin that case - Preserve extended methods from class-based types in
SchemaExtender::extend() - Fix printing of empty types (#940)
- Clone
NodeListinNode::cloneDeep() - Calling
Schema::getType()on a schema built from SDL returnsnullfor unknown types (#1068) - Avoid crash on typeless inline fragment when using
QueryComplexityrule - 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
- Deal with
iterablein implementations ofPromiseAdapter::all()
- Remove
OperationParamsmethodgetOriginalInput()in favor of public property$originalInput - Remove
OperationParamsmethodisReadOnly()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
isDeprecatedin field definition config - Remove
WrappingType::getWrappedType()argument$recursein favor ofWrappingType::getInnermostType() - Remove
Type::assertType() - Remove
ListOfType::$ofType,ListOfType::getOfType()andNonNull::getOfType() - Remove option
commentDescriptionsfromBuildSchema::buildAST(),BuildSchema::build()andPrinter::doPrint() - Remove parameter
$optionsfromASTDefinitionBuilder - Remove
FieldDefinition::create()in favor ofnew FieldDefinition() - Remove
GraphQL\Exception\InvalidArgument - Remove
Utils::find(),Utils::every()andUtils::invariant() - Remove argument
bool $exitWhenDonefromStandardServer::send500Error()andStandardServer::handleRequest() - Remove
Schema::getAstNode()in favor ofSchema::$astNode - Remove ability to override standard types through
Schemaoptiontypes, useType::overrideStandardTypes() - Remove
GraphQL\Utils\TypeInfo::typeFromAST(), useGraphQL\Utils\AST::typeFromAST() - Remove
StandardServer::send500Error(), handle non-GraphQL errors yourself - Remove
StandardServer::getHelper(), usenew Helper - Remove error extension field
category, use custom error formatting if you still need it - 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
- Fix PHP 8.2 deprecated string interpolation syntax
- Fix PHP 8.2 deprecated dynamic properties
- Accept AST where field arguments are not given
- Correct the broken 14.11.7 release - see webonyx#1221
- Fix PHP 8.2 deprecation of "static" in callables
- Fix validation of modified sparse ASTs
- Fix
extend()to preserverepeatable(#931)
- Fix repeatable directive validation for AST
- Fix compatibility of more methods with native return type in PHP 8.1
- Support non-JSON
ServerRequestInterface
- Fix compatibility of methods with native return type in PHP 8.1
- Allow field definitions to be defined as any
iterable, not justarray
- Make
IntTypeconstantsMAX_INTandMIN_INTpublic
- Add support for type config decorator in
SchemaExtender
- Implement
GraphQL\Utils\AST::getOperationAST()
- Allow providing field definitions as a callable and resolve them lazily
- Avoid crashing in
QueryPlanwhen__typenameis used in the query
Refactoring:
- Improve performance of subtype checks
- Fix overly eager validation of repeatable directive usage
- Add fallback for
directive.isRepeatableinBuildClientSchema
- Open ReferenceExecutor for extending
- Ensure properties annotated to hold NodeList are not null
- Validate that directive argument names do not use reserved or duplicate names
- Fix Input Object field shortcut definition with callable (#773)
- Implement support for interfaces implementing interfaces (#740), huge kudos to @Kingdutch
Deprecates:
-
Constant
BreakingChangeFinder::BREAKING_CHANGE_INTERFACE_REMOVED_FROM_OBJECT. UseBreakingChangeFinder::BREAKING_CHANGE_IMPLEMENTED_INTERFACE_REMOVEDinstead. Constant value also changed fromINTERFACE_REMOVED_FROM_OBJECTtoIMPLEMENTED_INTERFACE_REMOVED. -
Constant
BreakingChangeFinder::DANGEROUS_CHANGE_INTERFACE_ADDED_TO_OBJECTUseDANGEROUS_CHANGE_IMPLEMENTED_INTERFACE_ADDEDinstead. Constant value also changed fromINTERFACE_ADDED_TO_OBJECTtoIMPLEMENTED_INTERFACE_ADDED.
Refactoring:
- Reify AST node types and remove unneeded nullability (#751)
- Allow pushing nodes to
NodeListvia[]=(#767) - Fix signature of
Error\FormattedError::prepareFormatter()to address PHP8 deprecation (#742) - Do not add errors key to result when errors discarded by custom error handler (#766)
- Fixed
SchemaPrinterso that it uses late static bindings when extended - Parse
DirectiveDefinitionNode->locationsasNodeList<NamedNode>(fixes AST::fromArray conversion) (#723) - Parse
Parser::implementsInterfacesasNodeList<NamedTypeNode>(fixes AST::fromArray conversion) - Fix signature of
Parser::unionMemberTypesto match actualNodeList<NamedTypeNode>
- Allow
typeLoaderto return a type thunk (#687)
- Read getParsedBody() instead of getBody() when Request is ServerRequest (#715)
- Fix default get/set behavior on InputObjectField and FieldDefinition (#716)
Deprecates:
- Public access to
FieldDefinition::$typeproperty (#702)
Fixes:
- Fix validation for input field definition directives (#714)
- Handle nullable
DirectiveNode#astNodeinSchemaValidationContext(#708)
- Add partial parse functions for const variants (#693)
- Differentiate between client-safe and non-client-safe errors in scalar validation (#706)
- Proper type hints for
IntValueNode(#691) - Fix "only booleans are allowed" errors (#659)
- Ensure NamedTypeNode::$name is always a NameNode (#695)
- Visitor: simplify getVisitFn (#694)
- Replace function calls with type casts (#692)
- Optimize lazy types (#684)
- Fix for: Argument defaults with integer/float values crashes introspection query (#679)
- Fix for "Invalid AST Node: false" error (#685)
- Fix double Error wrapping when parsing variables (#688)
- Do not use call_user_func or call_user_func_array (#676)
- Codestyle and static analysis improvements (#648, #690)
This release brings several breaking changes. Please refer to UPGRADE document for details.
- BREAKING/BUGFIX: Strict coercion of scalar types (#278)
- BREAKING/BUGFIX: Spec-compliance: Fixed ambiguity with null variable values and default values (#274)
- BREAKING: Removed deprecated directive introspection fields (onOperation, onFragment, onField)
- BREAKING:
GraphQL\Deferrednow extendsGraphQL\Executor\Promise\Adapter\SyncPromise - BREAKING: renamed several types of dangerous/breaking changes (returned by
BreakingChangesFinder) - BREAKING: Renamed
GraphQL\Error\DebugtoGraphQL\Error\DebugFlag. - BREAKING: Debug flags in
GraphQL\Executor\ExecutionResult,GraphQL\Error\FormattedErrorandGraphQL\Server\ServerConfigdo not acceptbooleanvalue anymore butintonly. - BREAKING:
$positionsinGraphQL\Error\Errorconstructor are not nullable anymore. Same can be expressed by passing an empty array.
- Support repeatable directives (#643)
- Support SDL Validation and other schema validation improvements (e.g. #492)
- Added promise adapter for Amp (#551)
- Query plan utility improvements (#513, #632)
- Allow retrieving query complexity once query has been completed (#316)
- Allow input types to be passed in from variables using \stdClass instead of associative arrays (#535)
- Support UTF-16 surrogate pairs within string literals (#554, #556)
- Compliant with the GraphQL specification June 2018 Edition
- Having an empty string in
deprecationReasonwill now print the@deprecateddirective (only anulldeprecationReasonwon't print the@deprecateddirective).
- Perf: support lazy type definitions (#557)
- Simplified Deferred implementation (now allows chaining like promises, #573)
- Deprecated Experimental executor (#397)
- Some bugs
- Improve accuracy of type hints with PHPStan
Special thanks to @simPod, @spawnia and @shmax for their major contributions!
- Fix double Error wrapping when parsing variables (#689)
- Don't call global field resolver on introspection fields (#481)
- Added retrieving query complexity once query has been completed (#316)
- Allow input types to be passed in from variables using \stdClass instead of associative arrays (#535)
- QueryPlan can now be used on interfaces not only objects. (#495)
- Array in variables in place of object shouldn't cause fatal error (fixes #467)
- Scalar type ResolverInfo::getFieldSelection support (#529)
- Fix coroutine executor when using with promise (#486)
- Force int when setting max query depth (#477)
- Reverted minor possible breaking change (#476)
- Added QueryPlan support (#436)
- Fixed an issue with NodeList iteration over missing keys (#475)
- Better validation of field/directive arguments
- Support for apollo client/server persisted queries
- Minor tweaks and fixes
This release brings several breaking changes. Please refer to UPGRADE document for details.
New features and notable changes:
- PHP version required: 7.1+
- Spec compliance: error
categoryand extensions are displayed underextensionskey when using default formatting (#389) - New experimental executor with improved performance (#314).
It is a one-line switch:GraphQL::useExperimentalExecutor().
Please try it and post your feedback at webonyx#397 (as it may become the default one in future)
- Ported
extendSchemafrom the reference implementation underGraphQL\Utils\SchemaExtender(#362) - Added ability to override standard types via
GraphQL::overrideStandardTypes(array $types)(#401) - Added flag
Debug::RETHROW_UNSAFE_EXCEPTIONSwhich would only rethrow app-specific exceptions (#337) - Several classes were renamed (see UPGRADE.md)
- Schema Validation improvements
- Bugfix: Call to a member function getLocation() on null (#336)
- Fixed several errors discovered by static analysis (#329)
- Execution performance optimization for lists
- Allow stringeable objects to be serialized by StringType (#303)
- StandardServer: add support for the multipart/form-data content type (#300)
- SchemaPrinter: Use multi-line block for trailing quote (#294)
- Fixed bug in validation rule OverlappingFieldsCanBeMerged (#292)
- Added one more breaking change note in UPGRADE.md (#291)
- Spec compliance: remove
dataentry from response on top-level error (#281)
- RFC: Block String (multi-line strings via triple-quote """string""")
- GraphQL Schema SDL: Descriptions as strings (including multi-line)
- Changed minimum required PHP version to 5.6
Improvements:
- Allow extending GraphQL errors with additional properties
- Fixed parsing of default values in Schema SDL
- Handling several more cases in findBreakingChanges
- StandardServer: expect
operationName(instead ofoperation) in input
- Allow objects with __toString in IDType
- findBreakingChanges utility (see #199)
- StandardServer: Support non pre-parsed PSR-7 request body (see #202)
- Bugfix: provide descriptions to custom scalars (see #181)
- Ability to override internal types via
typesoption of the schema (see #174).
This release brings little changes but there are two reasons why it is released as major version:
- To follow reference implementation versions (it matches 0.11.x series of graphql-js)
- It may break existing applications because scalar input coercion rules are stricter now:
In previous versions sloppy client input could leak through with unexpected results. For example string"false"accidentally sent in variables was converted to booleantrueand passed to field arguments. In the new version, such input will produce an error (which is a spec-compliant behavior).
Improvements:
- Stricter input coercion (see #171)
- Types built with
BuildSchemanow have reference to AST node with corresponding AST definition (in $astNode property) - Account for query offset for error locations (e.g. when query is stored in
.graphqlfile)
- StandardServer improvement: do not raise an error when variables are passed as empty string (see #156)
- Fixed infinite loop in the server (see #153)
This release brings several breaking changes. Please refer to UPGRADE document for details.
New features and notable changes:
- Changed minimum PHP version from 5.4 to 5.5
- Lazy loading of types without separate build step (see #69, see docs)
- PSR-7 compliant Standard Server (see docs)
- New default error formatting, which does not expose sensitive data (see docs)
- Ability to define custom error handler to filter/log/re-throw exceptions after execution (see docs)
- Allow defining schema configuration using objects with fluent setters vs array (see docs)
- Allow serializing AST to array and re-creating AST from array lazily (see docs)
- Apollo-style query batching support via server (see docs)
- Schema validation, including validation of interface implementations (see docs)
- Ability to pass custom config formatter when defining schema using GraphQL type language (see docs)
Improvements:
- Significantly improved parser performance (see #137 and #128)
- Support for PHP7 exceptions everywhere (see #127)
- Improved documentation and docblock comments
Deprecations and breaking changes - see UPGRADE document.
- Minor change to assist DataLoader project in fixing #150
- Fixed PHP notice and invalid conversion when non-scalar value is passed as ID or String type (see #121)
- Fixed bug occurring when enum
valueis bool, null or float (see #141)
- Ability to disable introspection (see #131)
- Fixed issue with query complexity throwing on invalid queries (see #125)
- Fixed "Out of memory" error when
resolveTypereturns unexpected result (see #119)
- Bugfix: throw UserError vs InvariantViolationError for errors caused by client (see #123)
- Bugfix: use directives when calculating query complexity (see #113)
- Bugfix:
AST\Node::__toString()will convert node to array recursively to encode to json without errors
- Bugfix:
ResolveInfo::getFieldSelection()now correctly merges fragment selections (see #98)
- Bugfix:
ResolveInfo::getFieldSelection()now respects inline fragments
- Fixed SyncPromiseAdapter::all() to not change the order of arrays (see #92)
- Tools to help building schema out of Schema definition language as well as printing existing schema in Schema definition language (see #91)
- Fixed Utils::assign() bug related to detecting missing required keys (see #89)
- Schema Definition Language: element descriptions can be set through comments (see #88)
- Fixed:
GraphQL\Servernow properly sets promise adapter before executing query
- Deferred resolvers (see #66, see docs)
- New Facade class with fluid interface:
GraphQL\Server(see #82) - Experimental: ability to load types in Schema lazily via custom
TypeResolutionStrategy(see #69)
This release brings several minor breaking changes. Please refer to UPGRADE document for details.
New features:
- Support for
nullvalue (as required by latest GraphQL spec) - Shorthand definitions for field and argument types (see #47)
pathentry in errors produced by resolvers for better debuggingresolveTypefor interface/union is now allowed to return string name of type- Ability to omit name when extending type class (vs defining inline)
Improvements:
- Spec compliance improvements
- New docs and examples
Look at GitHub Releases Page.