Skip to main content
Version: Next

Changelog

8.4.0​

Breaking Changes​

  • #[EnumValue] now controls enum case exposure. Once any case of a #[Type]-mapped enum carries #[EnumValue], the enum is in opt-in mode: only annotated cases are exposed and unannotated cases are hidden from the schema (mirroring #[Field]'s opt-in model on classes). A fully-unannotated mapped enum still exposes every case and emits a deprecation notice. Migration: any enum that intentionally left some cases unannotated (for example, for docblock-only descriptions) must now add #[EnumValue] to every case it wants exposed.
  • Accessor prefixes are now stripped only on a camelCase boundary (the character after the prefix must be uppercase). Method names such as getaway(), issue(), settings() or setup() (a prefix followed by a lowercase letter) are no longer mis-stripped and keep their full name as the field name. Migration: if a #[Field]/#[SourceField] method relied on the old behavior (for example issue() exposing a field named sue), set an explicit field name with #[Field(name:)] or the source field's name.
  • Description metadata is rendered as a Markdown list after a blank line, so the #[Cost] text in introspection and printed schemas changes from Cost: complexity = ... on its own line to the list item - Cost: complexity = .... Migration: update anything that parses or snapshots field descriptions. (#838) @oojacoboo
  • An omitted input field typed T|null|Undefined without a PHP default now resolves to Undefined::VALUE instead of null, and no longer prints a = null default in the schema. A constructor parameter or property without a PHP default gets Undefined::VALUE too, instead of being left unset, unless the constructor already assigned the property. Migration: code that treated null as "not sent" for such a field should compare against Undefined::VALUE. (#838) @oojacoboo

New Features​

  • #[EnumValue] is now the per-case schema-exposure toggle, so internal enum cases can be kept out of the public schema by omitting the attribute. (#826)
  • SchemaFactory::stripFieldPrefixes(getters:, setters:) configures the method-name prefixes stripped to derive field names and matched when resolving property accessors. Adding has to the getters exposes hassers such as hasStock() via #[SourceField]; the defaults (get/is, set) preserve the previous behavior. (#827, generalizing #766) @oojacoboo @adynemo
  • #822 Accept PHP callables as #[Security] rules @oojacoboo, alongside the existing expression form, with access to the field context and custom refusal messages.
  • Arguments and input fields typed T|Undefined now say in their GraphQL description that they may be omitted and whether null is accepted ("May be omitted; null is not accepted." or "May be omitted; null is accepted."), since GraphQL types can't express it. Disable with SchemaFactory::setUndefinedDescriptionsEnabled(false). (#838) @oojacoboo
  • Field and input field middlewares add description metadata as list items with withAddedDescriptionItem(). QueryFieldDescriptor::withAddedDescriptionLines() is deprecated in favor of it. (#838) @oojacoboo

Bug Fixes​

  • #819 Fix undefined array input type @michael-georgiadis
  • An explicit null sent for an argument or input field typed T|Undefined (without null) is now refused with a client error naming it, instead of failing with a TypeError. (#838) @oojacoboo
  • #793 Argument @param descriptions no longer reach the schema when SchemaFactory::setDocblockDescriptionsEnabled(false) is set. (#838) @oojacoboo
  • Psr15GraphQLMiddlewareBuilder::limitQueryComplexity() no longer turns invalid variables into a single joined error without locations. Its rule, TheCodingMachine\GraphQLite\Validator\Rules\QueryComplexity, leaves them to the executor, which refuses each variable with its own located error. (#839) @oojacoboo

>8.0.0​

For all future changelog details, refer to the Releases. This CHANGELOG.md will no longer be independently maintained.

8.0.0​

Breaking Changes​

Improvements​

Bug Fixes​

Minor Changes​

7.1.0​

Breaking Changes​

  • #698 Removes some methods and classes, namely:
    • Deprecated SchemaFactory::addControllerNamespace() and SchemaFactory::addTypeNamespace() in favor of SchemaFactory::addNamespace()
    • Deprecated SchemaFactory::setGlobTTL() in favor of SchemaFactory::devMode() and SchemaFactory::prodMode()
    • Removed FactoryContext::get*TTL() and RootTypeMapperFactoryContext::get*TTL() as GraphQLite no longer uses TTLs to invalidate caches
    • Removed StaticClassListTypeMapper in favor of ClassFinderTypeMapper used with StaticClassFinder
    • Renamed GlobTypeMapper to ClassFinderTypeMapper
    • Renamed SchemaFactory::setClassBoundCacheContractFactory() to SchemaFactory::setClassBoundCache(), FactoryContext::getClassBoundCacheContractFactory() to FactoryContext::getClassBoundCache() and changed their signatures
    • Removed RootTypeMapperFactoryContext::getTypeNamespaces() in favor of RootTypeMapperFactoryContext::getClassFinder()

Improvements​

  • #698 Performance optimizations and caching in development environments (devMode()). @oprypkhantc

7.0.0​

Breaking Changes​

  • #664 Replaces thecodingmachine/class-explorer with kcs/class-finder resulting in the SchemaFactory::setClassNameMapper being renamed to SchemaFactory::setFinder. This now expects an instance of Kcs\ClassFinder\Finder instead of Kcs\ClassFinder\Finder\FinderInterface. @fogrye

New Features​

  • #649 Adds support for subscription operations. @oojacoboo
  • #612 Automatic query complexity analysis. @oprypkhantc
  • #611 Automatic persisted queries. @oprypkhantc

Improvements​

  • #658 Improves on prefetching for nested fields. @grynchuk
  • #646 Improves exception handling during schema parsing. @fogrye
  • #636 Allows the use of middleware on construtor params/fields. @oprypkhantc
  • #623 Improves support for description arguments on types/fields. @downace
  • #628 Properly handles @param annotations for generics support on field annotated constructor arguments. @oojacoboo
  • #584 Immutability improvements across the codebase. @oprypkhantc
  • #588 Prefetch improvements. @oprpkhantc
  • #606 Adds support for phpdoc descriptions and deprecation annotations on native enums. @mdoelker
  • Thanks to @shish, @cvergne and @mshapovalov for updating the docs!

Minor Changes​

  • #639 Added support for Symfony 7. @janatjak

6.2.3​

Adds support for Psr\Container 1.1 with #601

6.2.2​

This is a very simple release. We support Doctrine annotation 1.x and we've deprecated SchemaFactory::setDoctrineAnnotationReader in favor of native PHP attributes.

6.2.1​

  • Added support for new Void return types, allowing use of void from operation resolvers. #574
  • Improvements with authorization middleware #571
  • Updated vendor dependencies: #580 #558

6.2.0​

Lots of little nuggets in this release! We're now targeting PHP ^8.1 and have testing on 8.2.

  • Better support for union types and enums: #530, #535, #561, #570
  • Various bug and interface fixes: #532, #575, #564
  • GraphQL v15 required: #542
  • Lots of codebase improvements, more strict typing: #548

A special thanks to @rusted-love and @oprypkhantc for their contributions.

6.1.0​

A shoutout to @bladl for his work on this release, improving the code for better typing and PHP 8.0 syntax updates!

Breaking Changes​

  • #518 PSR-11 support now requires version 2
  • #508 Due to some of the code improvements, additional typing has been added to some interfaces/classes. For instance, RootTypeMapperInterface::toGraphQLOutputType and RootTypeMapperInterface::toGraphQLInputType now have the following signatures:
    /**
* @param (OutputType&GraphQLType)|null $subType
*
* @return OutputType&GraphQLType
*/
public function toGraphQLOutputType(
Type $type,
OutputType|null $subType,
ReflectionMethod|ReflectionProperty $reflector,
DocBlock $docBlockObj
): OutputType;

/**
* @param (InputType&GraphQLType)|null $subType
*
* @return InputType&GraphQLType
*/
public function toGraphQLInputType(
Type $type,
InputType|null $subType,
string $argumentName,
ReflectionMethod|ReflectionProperty $reflector,
DocBlock $docBlockObj
): InputType;

Improvements​

  • #510
  • #508

5.0.0​

Dependencies​

4.3.0​

Breaking change​

  • The method setAnnotationCacheDir($directory) has been removed from the SchemaFactory. The annotation cache will use your Psr\SimpleCache\CacheInterface compliant cache handler set through the SchemaFactory constructor.

Minor changes​

  • Removed dependency for doctrine/cache and unified some of the cache layers following a PSR interface.
  • Cleaned up some of the documentation in an attempt to get things accurate with versioned releases.

4.2.0​

Breaking change​

The method signature for toGraphQLOutputType and toGraphQLInputType have been changed to the following:

/**
* @param \ReflectionMethod|\ReflectionProperty $reflector
*/
public function toGraphQLOutputType(Type $type, ?OutputType $subType, $reflector, DocBlock $docBlockObj): OutputType;

/**
* @param \ReflectionMethod|\ReflectionProperty $reflector
*/
public function toGraphQLInputType(Type $type, ?InputType $subType, string $argumentName, $reflector, DocBlock $docBlockObj): InputType;

New features​

  • @Input annotation is introduced as an alternative to #[Factory]. Now GraphQL input type can be created in the same manner as #[Type] in combination with #[Field] - example.
  • New attributes has been added to @Field annotation: for, inputType and description.
  • The following annotations now can be applied to class properties directly: #[Field], #[Logged], #[Right], @FailWith, @HideIfUnauthorized and #[Security].

4.1.0​

Breaking change​

There is one breaking change introduced in the minor version (this was important to allow PHP 8 compatibility).

  • The ecodev/graphql-upload package (used to get support for file uploads in GraphQL input types) is now a "recommended" dependency only. If you are using GraphQL file uploads, you need to add ecodev/graphql-upload to your composer.json.

New features​

  • All annotations can now be accessed as PHP 8 attributes
  • The @deprecated annotation in your PHP code translates into deprecated fields in your GraphQL schema
  • You can now specify the GraphQL name of the Enum types you define
  • Added the possibility to inject pure Webonyx objects in GraphQLite schema

Minor changes​

  • Migrated from zend/diactoros to laminas/diactoros
  • Making the annotation cache directory configurable

Miscellaneous​

  • Migrated from Travis to Github actions

4.0.0​

This is a complete refactoring from 3.x. While existing annotations are kept compatible, the internals have completely changed.

New features​

Many extension points have been added

  • Added a "root type mapper" (useful to map scalar types to PHP types or to add custom annotations related to resolvers)
  • Added "field middlewares" (useful to add middleware that modify the way GraphQL fields are handled)
  • Added a "parameter type mapper" (useful to add customize parameter resolution or add custom annotations related to parameters)

New framework specific features:

Symfony​

  • The Symfony bundle now provides a "login" and a "logout" mutation (and also a "me" query)

Laravel​

Internals​

  • The FieldsBuilder class has been split in many different services (FieldsBuilder, TypeHandler, and a chain of root type mappers)
  • The FieldsBuilderFactory class has been completely removed.
  • Overall, there is not much in common internally between 4.x and 3.x. 4.x is much more flexible with many more hook points than 3.x. Try it out!