Commit Graph

38 Commits

Author SHA1 Message Date
spawnia
1ec4927f69 Add namespace to class 2018-09-03 22:13:05 +02:00
spawnia
c4fe304efe Fix coding style 2018-09-03 21:43:02 +02:00
Benedikt Franke
e7513e356a
Merge branch 'master' into patch-1 2018-09-03 21:25:36 +02:00
spawnia
326e0b4719 Add Debug::RETHROW_UNSAFE_EXCEPTIONS flag
This allows for a more granular default for which Exceptions are thrown, taking
the settings made through the ClientAware interface into account.

- Add docs
- Add a test case
- Differentiate clearly from other test
2018-09-03 21:18:04 +02:00
Jeremiah VALERIE
62de403f27
Use right assert method 2018-09-02 17:20:38 +02:00
Jeremiah VALERIE
eb7ff7048d
Removed unused use for anonymous functions 2018-09-02 17:20:38 +02:00
Simon Podlipsky
7dbd72cebf
Check CS in the whole project
Closes #284
2018-09-02 16:46:58 +02:00
Simon Podlipsky
bd8722652a
Fix CS in tests/Server 2018-09-02 10:18:45 +02:00
Simon Podlipsky
715146cdd1
Add void return typehint to test methods 2018-08-31 14:41:18 +02:00
Vladimir Razuvaev
c3d69c7c2b Fixed tests for PHPUnit 7+ 2018-08-07 23:59:48 +07:00
Simon Podlipsky
24b6b736b2
Upgrade PHPUnit 2018-07-29 19:01:39 +02:00
Iain Mckay
750ce383ec Adds support for the multipart/form-data content type 2018-07-05 08:52:29 +02:00
Vladimir Razuvaev
7762430bc3
Merge pull request #256 from camuthig/fix-operation-param-operation-name
Parse operation name from operationName instead of operation
2018-03-29 20:25:39 +08:00
Chris Muthig
68eb325d18
Add a unit test covering the operationName parsing 2018-03-28 13:55:59 -07:00
Chris Muthig
8aa6dc17a5
Parse operation name from operationName instead of operation 2018-03-03 15:41:55 -08:00
Daniel Tschinder
60df83f47e Preserve original coercion errors, improve error quality.
This is a fairly major refactoring of coerceValue which returns an Either so it can return a complete collection of errors. This allows originalError to be preserved for scalar coercion errors and ensures *all* errors are represented in the response.

This had a minor change to the logic in execute / subscribe to allow for buildExecutionContext to abrupt complete with multiple errors.

ref: graphql/graphql-js#1133
2018-02-13 16:51:44 +01:00
Daniel Tschinder
15374a31dd New: printError()
Lifted from / inspired by a similar change in graphql/graphql-js#722, this creates a new function `printError()` (and uses it as the implementation for `GraphQLError#toString()`) which prints location information in the context of an error.

This is moved from the syntax error where it used to be hard-coded, so it may now be used to format validation errors, value coercion errors, or any other error which may be associated with a location.

ref: graphql/graphql-js

BREAKING CHANGE: The SyntaxError message does not contain the codeframe anymore and only the message, (string) $error will print the codeframe.
2018-02-12 12:23:39 +01:00
Vladimir Razuvaev
4f223ba11d Fixed PSR request parsing, broken after recent changes 2018-01-13 18:08:07 +07:00
Vladimir Razuvaev
918bbff2bd
Merge branch 'master' into no-parsing 2018-01-13 17:20:00 +07:00
Adrien Crivelli
5cbaf973e1
Leverage PHPUnit setExpectedException() instead of custom code
Closes #219
2018-01-01 18:06:08 +09:00
Adrien Crivelli
178b179db3
Drop support non pre-parsed PSR-7 request body
This revert #202 (commit 9d37f4c) because trying to parse PSR-7 request
was a mistake. The whole point of PSR-7 is to allow for interoperability
and be able to use specialized libs for body parsing (amongst many other
things). Trying to parse ourselves would be opening a can of worm if/when
other content types have to be supported. It is more correct and future
safe to require that the body is parsed before being passed to GraphQL.
2017-12-21 15:01:57 +09:00
Adrien Crivelli
11c9429fab
Support non pre-parsed PSR-7 request body
Because PSR-7 specification only specify that `getParsedBody()` **may**
return the parsed body for `application/json`, we cannot assume that it
is always the case. So if the value returned parsed body is an empty array,
it means we should try to parse it ourselves (`null` would mean no body at
all according to spec).

With this modification we try to used given parsed body, but fallback on
trying to parse the body if necessary. This leave the door open to custom
implementation of parsing if needed, while making it easier to use out of
the box.
2017-11-26 19:57:32 +09:00
Vladimir Razuvaev
6ff427d241 Server: do not raise an error when variables are passed as empty string (#156) 2017-08-30 23:26:45 +07:00
Vladimir Razuvaev
d95fb461ee Server: fixed constructor screwed during rebasing + restored tests for the server 2017-08-21 01:18:23 +07:00
Vladimir Razuvaev
1b4f983f3f Improved docblock comments (suitable for reference docs generation) 2017-08-19 23:01:46 +07:00
Vladimir Razuvaev
203fddfe4e Abstract base class for validation rules 2017-08-18 20:56:04 +07:00
Vladimir Razuvaev
83cc9132a0 Server: minor improvements 2017-08-18 02:54:35 +07:00
Vladimir Razuvaev
03629c1e3c Refactored error formatting (debugging part) 2017-08-17 18:49:17 +07:00
Vladimir Razuvaev
3971001f6d Server: additional tests + related fixes 2017-08-15 20:59:48 +07:00
Vladimir Razuvaev
828c6b0fc3 Server: disable query batching by default; allow array as server config 2017-08-15 18:05:09 +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
e04d3300a7 Server: send result for regular responses + prepare response for PSR7 request 2017-07-21 22:11:20 +07:00
Vladimir Razuvaev
e6e531b88b Server: throw only when there is a configuration or logic error (invariant violation) 2017-07-19 19:30:39 +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
919cf80240 Server: batched queries with shared deferreds (promises) #105 2017-07-17 20:31:26 +07:00
Vladimir Razuvaev
0e2ac57515 Split HTTP server execution to canonical replaceable steps: parsing, validation, execution with separate tests for each step 2017-07-17 16:57:30 +07:00
Vladimir Razuvaev
f8c3195e54 Granular methods for HTTP request parsing + tests 2017-07-16 19:04:58 +07:00
Vladimir Razuvaev
794d3672ef Initial pass on standard server implementation (also deprecated current GraphQL\Server which is undocumented anyway) 2017-07-14 19:44:18 +07:00