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.
- Throw
Spawnia\Sailor\Error\UnexpectedResponse
on non-200 status codes
- Make
Result::assertErrorFree()
return void
- Escape class names of result types named after PHP reserved keywords
- Validate operation names start with upper case characters
- Improve configuration documentation
- Include
extensions.debugMessage
in errors, if present
- Remove
EndpointConfig::searchPath()
, requirefinder()
instead
- Add
DirectoriesFinder
- Use PHPUnit 11 attributes for testing helpers
- Allow
symfony/var-exporter:^7
- Fix registering commands with symfony/console v7
- Allow
symfony/console:^7
- Fix namespace printing with
nette/php-generator:^4.1.1
- Do not assume scalar values are
string
, usemixed
- Default to
null
when explicitly accessing undefined optional input properties
- Allow
EndpointConfig::configureTypes()
to customize object, interface and union type code generation - Add
Operation::clearClients()
andClearsSailorClients
- Only instantiate client once per operation
- Expect
callable $request
inMockClient
constructor over pushing to$responseMocks
- Clear log file when instantiating
Log
- Handle queries with explicit
__typename
in fragments
- Support
nette/php-generator:^4
- Support
webonyx/graphql-php:^15
- Include client directives when inlining fragments
- Accept
int
in arguments of typeID
andFloat
- Split
TypeConfig::typeReference()
intoInputTypeConfig::inputTypeReference()
andOutputTypeConfig::outputTypeReference()
- Implement
PolymorphicConverter::toGraphQL()
- Accept any array as inputs and serialize it as a list
- Normalize path to config file
- Pass events
StartRequest
andReceiveResponse
toEndpointConfig::handleEvent()
- Add support for types and fields named equivalent to PHP keywords like
type Switch
or{ print { subfield } }
- No longer generate class
TypeConverters
- Always create log file when instantiating
Log
client
- Improve validation error for missing fields or required data
- Add correct
__typename
in polymorphic typesmake()
method
- Allow specifying
--configuration
option to CLI commands to read specific config file
- Ignore the schema itself when looking for operations
- Simply ignore non-executable definitions
- Support fragments
- Merge fields between diverging subtrees within inline fragments
- Allow customizing how documents are found
- Validate endpoint names in
introspect
command are strings
- Fix PHP 8.1 compatibility
- Allow
thecodingmachine/safe
v2 as dependency
- Set errors property of
Spawnia\Sailor\Error\ResultErrorsException
- Use self-explanatory string value for
ObjectLike::UNDEFINED
- Add configuration
EndpointConfig::errorsAreClientSafe()
to propagate client-safety of endpoint errors
- Move
Spawnia\Sailor\ResultErrorsException
toSpawnia\Sailor\Error\ResultErrorsException
- Move
Spawnia\Sailor\InvalidDataException
toSpawnia\Sailor\Error\InvalidDataException
- Include only messages in
ResultErrorsException::$message
, expose fullError
objects asResultErrorsException::$errors
- Remove
Spawnia\Sailor\Response::assertErrorFree()
- Add ability to overwrite parsing of errors
- Convert errors from plain
stdClass
toSpawnia\Sailor\Error\Error
in results
- Fix conversion of custom types used directly in variables
- Generate operations under namespace
Operations
- Generate enums and inputs under namespace
Types
- Base inputs and results on class
ObjectLike
- Allow customization of how Sailor deals with types using
EndpointConfig::configureTypes()
- Allow additional code generation with
EndpointConfig::generateClasses()
- Ease mock result instantiation with
Result::fromData()
andResult::fromErrors()
- Ease input and mock data instantiation with
ObjectLike::make()
- Allow
symfony/console
andsymfony/var-exporter
v6 as dependencies
- Generate Enums and Inputs from the schema
- Operations with input object types as arguments expect generated classes instead of
\stdClass
- The operation names
Inputs
andEnums
are now reserved
- Support interfaces
- Support unions
- Ensure generated code complies with PHPStan v1 at level max
- Always add field
__typename
to any subselection and have it available in the result throughTypedObject
- Name generated
TypedObject
classes after the corresponding object type
- Fall back to not querying
Directive.isRepeatable
if it is not available
- Allow
"nette/php-generator": "^3.6.3"
- Allow overwriting the client from EndpointConfig for specific operations or per request
- Add PSR-18 client #28
Response::fromResponseInterface()
no longer accepts non-200 status codes
- Remove forced dependency on
guzzle/guzzle
- Add methods
Log::requests()
andLog::clear()
to ease assertions onLog
client #25
- Add
Log
client for integration testing #24
- Return the first registered mock instance for each operation class
on subsequent calls to
Operation::mock()
- Fix initialization of Result from Response
- Improve error message when trying to map unknown fields onto result classes
- Add method
Result::errorFree()
to ease safe access to a result class without errors
- Allow mocking single operations with Mockery
- Fix codegen for operations with multiple parameters
- Require
Directive.isRepeatable
on introspection - Use typed properties
- Rewrite
Configuration
class
- Remove
EndpointConfig::$mockClient
andEndpointConfig::client()
- Support PHP 8
- Require PHP 7.4 or 8
- Require newer versions of various dependencies
- Fetch introspection results via
vendor/bin/sailor introspect
- Define operations in
.graphql
files and automatically generate client code - Statically validate correctness of defined operations