Derek Lavigne
d22385cc93
Update query variable coercion to meet the rules outlined in the
...
specification.
The framework currently coerces query variables similar to the way it
treats output values, which means it attempts to coerce the value into
the field's corresponding data type regardless of the received value.
According to items 3f and 3g in section 6.1.2
(http://facebook.github.io/graphql/#sec-Validating-Requests ) of
Facebook's GraphQL specification query variables should be coerced
according to their type's input coercion rules laid out in section
3.1.1 (http://facebook.github.io/graphql/#sec-Scalars ). If the value
can not be coerced into the correct type according the the input
coercion rules for the type a query error should be thrown. This
ensures that client provided query variables were of the correct format
and will be a valid format and type by the time they are passed into an
implementing resolver.
This patch fixes the above issue by updating the way query variables
are sanitized during the process of parsing the query. It directly
follows the rules for scalar input coercion laid out by the
specification and throws query errors when a value that cannot be
coerced to the correct type is given. Tests for isValidPHPValue will
also be updated to ensure that it is doing the correct type checks on
Values::isValidPHPValue for the given type and value provided. A new
test case will also be added to test Values::getVariableValues and make
sure it is also enforcing the scalar input coercion rules and throwing
errors for invalid values.
2017-09-18 12:14:09 -04:00
Vladimir Razuvaev
90602b31ba
Added link to docs for generic error about unique type instance ( #149 )
2017-08-20 22:28:17 +07:00
Vladimir Razuvaev
1b4f983f3f
Improved docblock comments (suitable for reference docs generation)
2017-08-19 23:01:46 +07:00
Vladimir Razuvaev
9931cde6d4
Tests for lazy type loading during query execution + related changed
2017-08-15 01:49:56 +07:00
Vladimir Razuvaev
e4813c3a05
Additional checks and tests for situations when user-land code returns duplicate type instances
2017-08-14 23:52:17 +07:00
Vladimir Razuvaev
b9d3a11785
Extracted lazy schema test; minor related refactoring
2017-08-14 20:41:08 +07:00
Vladimir Razuvaev
6845b28a35
Deprecated GraphQL\Type\Definition\Config
( #148 )
2017-08-14 00:09:02 +07:00
Vladimir Razuvaev
34eae0b891
Schema validation + tests ( #148 )
2017-08-13 23:04:03 +07:00
Vladimir Razuvaev
f911fac7b1
Default error reporting now includes "category" key for every error
2017-08-08 02:02:07 +07:00
Vladimir Razuvaev
38922dbbed
Default error formatter now returns "Internal server error" unless error is client-aware and safe to report directly to end-users
2017-07-18 20:57:30 +07:00
Vladimir Razuvaev
aaa5b7af41
Global config; descriptor moved to appropriate namespace; minor cleanup
2017-07-12 13:16:34 +07:00
Vladimir Razuvaev
296544089c
Moved GraphQL\Utils to GraphQL\Utils\Utils
2017-07-10 19:53:46 +07:00
Vladimir Razuvaev
ed28deda81
Replaced trigger_error with Warning for resolveType warning
2017-07-10 19:38:12 +07:00
Vladimir Razuvaev
9551569ffe
Merge branch 'lazy-types' into v0.10
...
# Conflicts:
# src/Executor/Executor.php
2017-07-10 17:11:41 +07:00
Vladimir Razuvaev
463d995d95
Reverted #116 (now Executor::defaultFieldResolver checks for instanceof Closure vs is_callable again)
2017-07-08 15:22:17 +07:00
Vladimir Razuvaev
9b9a74c1d1
Spec compliance: errors in buildExecutionContext() are caught and included in result rather than thrown
2017-07-05 17:33:59 +07:00
Vladimir Razuvaev
78d9ba0d5e
Allow providing default field resolver for execution call
2017-07-05 16:22:01 +07:00
Vladimir Razuvaev
34bd378c7e
Refactored executor logic related to isTypeOf
2017-07-04 00:09:32 +07:00
Vladimir Razuvaev
d64c352262
Ability for interface types to resolve type asynchronously
2017-07-03 23:08:20 +07:00
Vladimir Razuvaev
21e3445754
Merge pull request #116 from leocavalcante/resolve-callables
...
Resolve callables by default
2017-06-27 00:37:30 +07:00
Daniel Tschinder
65ef159ddc
Support PHP7 error exceptions everywhere
...
Also replace \Error with \Throwable
2017-06-25 07:33:28 -07:00
leocavalcante
8a5f337469
Extract anonymous class
2017-05-07 19:42:59 -03:00
leocavalcante
e07c86bd5e
Default resolve callables
2017-05-07 19:21:20 -03:00
Vladimir Razuvaev
ce9bf33f20
Ability to load types in schema on demand ( #69 )
2017-03-05 03:26:22 +07:00
Bernhard Schussek
e35b57601d
Fixed SyncPromiseAdapter::all() to not change the order of arrays
2017-02-23 11:45:13 +01:00
Juuso Leinonen
8626e0b45d
Make tests run on php 5.4
2016-12-22 15:35:38 +02:00
Juuso Leinonen
90c4b5d9fa
Changed ReactPromiseAdapter::all to preserve the array key order and added tests
2016-12-22 15:08:28 +02:00
vladar
ff3a40d329
Execution: modified deferred behavior to be more predictable (+added more tests for them)
2016-12-17 05:14:51 +07:00
vladar
a165c3aaab
Shortened method names of PromiseAdapter
2016-12-04 15:53:23 +07:00
vladar
26db4c76c6
Fixed tests for PHP7+
2016-12-03 04:31:01 +07:00
vladar
fd335a1d13
Execution: tests are green
2016-12-03 04:23:21 +07:00
vladar
7ab75cd05a
Execution: tests are green
2016-12-03 04:11:14 +07:00
vladar
ab4ae779af
Execution: fixed rejection issue in sync promise
2016-12-03 02:48:51 +07:00
vladar
e97ca7f971
Execution: added SyncPromiseAdapter and made it default for Executor (+removed GenericPromiseAdapter)
2016-12-03 02:14:14 +07:00
vladar
3a375bb78e
Simple implementation of Promises A+ for our sync case (using queue)
2016-12-02 18:43:54 +07:00
Jeremiah VALERIE
76c31df1af
Add Executor Promise tests
2016-11-26 23:51:42 +01:00
Jeremiah VALERIE
35d7d83088
Add Lists Promise tests
2016-11-26 22:28:46 +01:00
Jeremiah VALERIE
7f1e9d051b
Add Mutation Promise tests
2016-11-26 20:50:01 +01:00
Jeremiah VALERIE
2ad79adf0c
Add NonNull Promise tests
2016-11-26 20:50:01 +01:00
vladar
63d44fe002
Disabled deprecation notice for ResolveInfo->fieldASTs (until next version)
2016-11-19 17:37:54 +07:00
vladar
0ab55ec0d9
Replaced "AST" with "Node" in variable names for better readability
2016-11-19 06:47:55 +07:00
vladar
439959b292
Enforce input coercion rules
2016-11-19 04:15:40 +07:00
vladar
8a676cde99
Support for NullValue
2016-11-18 23:59:28 +07:00
vladar
c11f25794a
Deprecated callbacks in "type" option of field/argument definitions (see #35 )
2016-10-23 00:49:25 +07:00
vladar
276a58f6d1
Reverted one minor breaking change
2016-10-22 17:19:40 +07:00
vladar
a612b780c9
Return stdClass vs empty array for empty ObjectType values (see #59 )
2016-10-22 17:16:47 +07:00
vladar
2675b65095
Moved all error-related classes to separate namespace; fixed related broken tests
2016-10-21 16:40:56 +07:00
vladar
6d7a4a4f34
Fixed tests broken by recent changes to serialized error format
2016-10-21 15:28:24 +07:00
vladar
7f22d4b874
Spec compliance improvement: data key should not exist in response when it is null / missing ( #56 )
2016-10-18 22:25:39 +07:00
vladar
3e2d9459aa
resolveType for interface/unions is now allowed to return type name vs instance
2016-10-18 22:23:20 +07:00