Commit Graph

112 Commits

Author SHA1 Message Date
Aurélien David
e87460880c
QueryPlan can now be used on interfaces not only objects.
It's often the case to use interfaces in queries:

interface Pet { name: String! }

Query {
 pets: [Pet]
}
2019-06-12 11:59:42 +02:00
spawnia
c9faa3489b Add schema validation: Input Objects must not contain non-nullable circular references
Spec change: https://github.com/graphql/graphql-spec/pull/445
Reference implementation: https://github.com/graphql/graphql-js/pull/1359
2019-06-10 22:15:23 +02:00
Jonas Elfering
5b3f44c7a3 add queryplan 2019-02-01 22:39:00 +01:00
Yury
33e3c9c338
Error handling improvements 2018-11-28 17:35:21 +03:00
Vladimir Razuvaev
e1b4d438db Ability to override internal types (closes #401) 2018-11-27 15:39:20 +07:00
Vladimir Razuvaev
bdbb30c604 Schema validation improvements 2018-11-22 22:23:14 +07:00
Vladimir Razuvaev
7c19777dff Ensure interface has at least 1 concrete type 2018-11-21 20:11:11 +07:00
Vladimir Razuvaev
23169603fc Removed old experimental code 2018-11-03 23:25:23 +07:00
Simon Podlipsky
90d0156291
Use PHPStan strict rules
Two rules excluded: missing type hints and empty() usage
2018-10-09 17:46:55 +02:00
Simon Podlipsky
07c070d795
Fix CS in tests 2018-10-05 10:47:57 +02:00
Simon Podlipsky
c4e06ba528
Use self:: in tests where appropriate 2018-09-19 20:50:32 +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
b886742968
Fix CS in tests/Type 2018-09-02 12:55:40 +02:00
Simon Podlipsky
715146cdd1
Add void return typehint to test methods 2018-08-31 14:41:18 +02:00
Simon Podlipsky
a30b3104a0
Replace misleading @it by @see annotation 2018-08-31 10:55:14 +02:00
Vladimir Razuvaev
8817e8e010 Throws descriptive error when non-type used instead of interface 2018-08-22 18:53:25 +07:00
Vladimir Razuvaev
64c463e889 Schema: getTypeMap() should include input types defined in directive arguments 2018-08-08 15:47:42 +07:00
Vladimir Razuvaev
0d93d190f8 Updated introspection test 2018-08-08 15:11:33 +07:00
Vladimir Razuvaev
a19fc3d208 RFC: SDL - Separate multiple inherited interfaces with & 2018-08-08 01:11:47 +07:00
Vladimir Razuvaev
c3d69c7c2b Fixed tests for PHPUnit 7+ 2018-08-07 23:59:48 +07:00
Vladimir Razuvaev
39df711eac More definition tests (for type validation) 2018-08-07 23:32:26 +07:00
Simon Podlipsky
24b6b736b2
Upgrade PHPUnit 2018-07-29 19:01:39 +02:00
Théo FIDRY
c1a62fdb05 Allow stringeable objects to be serialized by StringType
Closes #302

(cherry picked from commit c258109)
2018-07-08 04:44:10 +07:00
Vladimir Razuvaev
1b22f95a86 Removed previously deprecated classes/methods 2018-05-27 19:13:32 +07:00
Daniel Tschinder
d92a2dab21 Add suggestions for invalid values
For misspelled enums or field names, these suggestions can be helpful.

This also changes the suggestions algorithm to better detect case-sensitivity mistakes, which are common

ref: graphql/graphql-js#1153
2018-02-16 16:19:25 +01:00
Daniel Tschinder
58e0c7a178 Validate literals in a single rule with finer precision
This generalizes the "arguments of correct type" and "default values of correct type" to a single rule "values of correct type" which has been re-written to rely on a traversal rather than the utility function `isValidLiteralValue`. To reduce breaking scope, this does not remove that utility even though it's no longer used directly within the library. Since the default values rule included another validation rule that rule was renamed to a more apt "variable default value allowed".

This also includes the original errors from custom scalars in the validation error output, solving the remainder of graphql/graphql-js#821.

ref: graphql/graphql-js#1144
2018-02-15 21:29:14 +01:00
Daniel Tschinder
97e8a9e200 Move schema validation into separate step (type constructors)
This is the second step of moving work from type constructors to the schema validation function.

ref: graphql/graphql-js#1132
2018-02-15 12:14:08 +01:00
Daniel Tschinder
9387548aa1 Better Predicates
Introduces new assertion functions for each kind of type mirroring the existing ones for the higher order types.

ref: graphql/graphql-js#1137
2018-02-13 18:04:03 +01: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
06c6c4bd97 Validate schema root types and directives
This moves validation out of GraphQLSchema's constructor (but not yet from other type constructors), which is responsible for root type validation and interface implementation checking.

Reduces time to construct GraphQLSchema significantly, shifting the time to validation.

This also allows for much looser rules within the schema builders, which implicitly validate while trying to adhere to flow types. Instead we use any casts to loosen the rules to defer that to validation where errors can be richer.

This also loosens the rule that a schema can only be constructed if it has a query type, moving that to validation as well. That makes flow typing slightly less nice, but allows for incremental schema building which is valuable

ref: graphql/graphql-js#1124
2018-02-13 10:42:35 +01:00
Daniel Tschinder
ff63e07b05 Improve introspection types + new getIntrospectionQuery()
This adds a new function `getIntrospectionQuery()` which allows for some minor configuration over the resulting query text: to exclude descriptions if your use case does not require them.

ref: graphql/graphql-js#1113
2018-02-11 18:19:52 +01:00
Daniel Tschinder
4e26de3588 Support for union types when using buildSchema
* Adds support for resolving union/interface types when using a generated schema
* Move resolveType __typename checking into defaultResolveType
* Clean up existing tests and improve error messages

ref: graphql/graphql-js#947

# Conflicts:
#	src/Utils/BuildSchema.php
#	tests/Utils/BuildSchemaTest.php
2018-02-10 18:45:01 +01:00
Adrien Crivelli
5cbaf973e1
Leverage PHPUnit setExpectedException() instead of custom code
Closes #219
2018-01-01 18:06:08 +09:00
Jáchym Toušek
f6c3fe3758
indentation 2017-12-12 13:36:20 +01:00
Jáchym Toušek
9e2c1dae87
Add test 2017-12-12 09:53:15 +01:00
Vladimir Razuvaev
f7248dec76 Ability to override internal types (using types option of Schema class) #174 2017-09-22 23:08:51 +07:00
Vladimir Razuvaev
6050af4e67 Add support for directives applied on IDL & Schema 2017-09-20 17:43:06 +07: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
9499e5ae8e Suppressing Config deprecation warning in tests 2017-08-18 18:07:23 +07:00
Vladimir Razuvaev
f369d4e2d4 Reverted unnecessary breaking change 2017-08-15 23:39:07 +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
8817d54e83 Validate that type loader always returns the same type instance as referenced in other parts of the schema 2017-08-14 22:32:07 +07:00
Vladimir Razuvaev
b9d3a11785 Extracted lazy schema test; minor related refactoring 2017-08-14 20:41:08 +07:00
Vladimir Razuvaev
f47db61907 Fully load all schema types in constructor when type loader is not set 2017-08-14 19:44:16 +07:00
Vladimir Razuvaev
884a8967f3 Type loader tests 2017-08-14 19:42:01 +07:00
Vladimir Razuvaev
20f8cab943 Removed schema descriptor (as lazy loading of types can work without it now) 2017-08-14 01:42:02 +07:00
Vladimir Razuvaev
f9eb14869f Removed callbacks in field types (previously deprecated in #35) 2017-08-14 00:50:24 +07:00