Sunli
7c62b10ebc
Fix #333
2020-11-03 18:16:55 +08:00
Sunli
89ab0c799f
Fix the problem of scalar
macro.
2020-11-03 13:50:22 +08:00
Sunli
d4e26192ce
Fix interface downcasting. #330
2020-10-31 08:58:54 +08:00
Sunli
a43432d530
Add test for SchemaBuilder::override_description
. #327
2020-10-27 20:47:24 +08:00
Sunli
770ed31508
Add use_type_description
attribute for derive macros Object, Scalar and Subscription.
2020-10-26 21:34:05 +08:00
Sunli
fc35787885
Add interface to implement another interface. #322
2020-10-24 09:08:18 +08:00
Sunli
8edd59ffdb
Fix the problem that the Registry::create_dummy_type
function may overwrite the keys of the registered type. #316
2020-10-20 19:55:10 +08:00
Sunli
776aadf169
Add entity lookup support for MergedObject.
...
Add some GraphQL specification constraints for all derived macros.
Use `Registry::create_dummy_type` to create a merged type.
2020-10-20 11:49:31 +08:00
Sunli
7510741311
Fix the bug that ʻExtension::prepare_request` cannot get the correct request data through the context.
...
Add test code for extension.
2020-10-18 11:24:16 +08:00
Koxiaet
807bad2a72
Fix macro hygiene
2020-10-16 20:21:46 +01:00
Koxiaet
68381cfc65
Make macros hygienic
2020-10-16 11:37:59 +01:00
Koxiaet
db312a372d
Replace futures with futures_util
2020-10-16 07:49:22 +01:00
Sunli
b054f1bf9f
Fix can no longer derive Union for union types with lifetimes. #311
2020-10-15 08:53:17 +08:00
Sunli
bc5cf2f2a2
Configurable case conversion.
2020-10-14 19:16:10 +08:00
Sunli
53ef84c5e3
Fix a bug in the validator.
2020-10-14 10:54:46 +08:00
Sunli
b1ecc6b8a9
2.0.1
2020-10-14 10:25:41 +08:00
Sunli
184f8b169d
Update docs
2020-10-13 10:19:30 +08:00
Sunli
b0ceb58163
Use value!
instead of serde_json::json!
.
2020-10-12 10:17:05 +08:00
Sunli
2ca10e0ded
Add parse_value
and from_value
funcntions.
2020-10-11 20:24:31 +08:00
Sunli
10cd868f4c
Some improvements.
2020-10-10 16:28:07 +08:00
AurelienFT
e7b4ad8f2f
Rework guard ( #296 )
...
Rework guard #293
2020-10-06 17:16:51 +08:00
Sunli
e263c755e2
Restore the original error extension implementation.
2020-10-02 14:56:10 +08:00
Koxiaet
b61088089b
Fix compilation and tests
2020-09-30 19:40:17 +01:00
Koxiaet
ab82460b81
Merge master
2020-09-30 18:24:24 +01:00
Koxiaet
2ddaaaa07f
Rework errors
...
This completely overhauls the error system used in async-graphql.
- `Error` has been renamed to `ServerError` and `FieldError` has been
renamed to just `Error`. This is because `FieldError` is by far the most
common error that users will have to use so it makes sense to use the
most obvious error name. Also, the current name didn't make sense as it
was used for things other than field errors, such as the data callback
for websockets.
- `ServerError` has been made completely opaque. Before it was an enum
of all the possible errors, but now it just contains an error message,
the locations, the path and extensions. It is a shame that we lose
information, it makes more sense as _conceptually_ GraphQL does not
provide that information. It also frees us to change the internals of
async-graphql a lot more.
- The path of errors is no longer an opaque JSON value but a regular
type, `Vec<PathSegment>`. The type duplication of `PathSegment` and
`QueryPathSegment` is unfortunate, I plan to work on this in the future.
- Now that `ServerError` is opaque, `RuleError` has been removed from
the public API, making it simpler.
- Additionally `QueryError` has been completely removed. Instead the
error messages are constructed ad-hoc; I took care to never repeat an
error message.
- Instead of constructing field-not-found errors inside the
implementations of field resolvers they now return `Option`s, where a
`None` value is representative of the field not being found.
- As an unfortunate consequence of the last change, self-referential
types based on the output of a subscription resolver can no longer be
created. This does not mean anything for users, but causes lifetime
issues in the implementation of merged objects. I fixed it with a bit of
a hack, but this'll have to be looked into further.
- `InputValueError` now has a generic parameter - it's kind of weird but
it's necessary for ergonomics. It also improves error messages.
- The `ErrorExtensions` trait has been removed. I didn't think the
`extend` method was necessary since `From` impls exist. But the
ergonomics are still there with a new trait `ExtendError`, which
is implemented for both errors and results.
- `Response` now supports serializing multiple errors. This allows for
nice things like having multiple validation errors not be awkwardly
shoved into a single error.
- When an error occurs in execution, data is sent as `null`. This is
slightly more compliant with the spec but the algorithm described in
<https://spec.graphql.org/June2018/#sec-Errors-and-Non-Nullability > has
yet to be implemented.
2020-09-29 20:06:44 +01:00
Sunli
8c5d8f0324
Rework async-graphql-derive. #288
2020-09-29 16:06:10 +08:00
Sunli
c460431715
Add feature to flatten nested GraphQL unions. #286
2020-09-28 11:13:46 +08:00
Sunli
2fc4750122
Add remote
attribute for Enum macro. #276
2020-09-27 18:19:11 +08:00
Sunli
9b4fc7d922
Make Object and Subscription macros support #cfg(...)
attribute. #281
2020-09-27 10:20:20 +08:00
Sunli
9333583483
Improve the error message of Tracing extension.
2020-09-26 12:35:28 +08:00
Sunli
897a3b9bb0
Add test code for generic object. #274
2020-09-23 14:39:18 +08:00
Sunli
5bfb992ad7
Fix enum strings in query variables are not converted to proper enums. #270
2020-09-20 13:28:18 +08:00
Sunli
322e296a24
Remove the GQL prefix of all macros. #208
2020-09-18 09:10:24 +08:00
Koxiaet
5cf527aeef
Merge branch 'master' of github.com-koxiaet:async-graphql/async-graphql into master
2020-09-17 19:23:15 +01:00
Koxiaet
88be6bca61
Improve websockets
2020-09-17 19:22:54 +01:00
Sunli
acc1a6f515
Add support for batch queries.
2020-09-17 19:54:12 +08:00
Sunli
c3d70b0553
Add test for ErrorExtensions.
2020-09-17 08:47:41 +08:00
Sunli
509c92a11f
Move http::websocket::create and http::websocket::create_with_initializer function to http::WebSocketStream.
2020-09-15 20:07:59 +08:00
Sunli
059128e9c5
http::websocket::create function now returns the WebSocketStream type.
2020-09-15 11:19:00 +08:00
Sunli
3233f3638c
Implement Type for more stdlib collection types #189
...
Implement InputValueType/OutputValueType for HashSet<T>/BTreeSet<T>/VecDeque<T>/LinkedList<T>
Implement ScalarType for char/NonZero*/HashMap<String,T>/BTreeMap<String, T>
2020-09-14 20:06:44 +08:00
Sunli
d67a511a07
2.0.0-alpha.5
2020-09-14 09:46:22 +08:00
Koxiaet
d404e756bc
Rework subscriptions
...
The main change in this commit is changing the return type of
SubscriptionType::create_stream from
Future<Result<Stream<Result<Response>>>> to just Stream<Result<Json>>. I
also allowed the returned stream to borrow from self and context.
2020-09-13 18:52:36 +01:00
Koxiaet
863d57a4b0
Remove SimpleBroker
2020-09-13 10:47:28 +01:00
Koxiaet
55753983a9
Move websockets to http module and fix doc tests
2020-09-13 07:40:34 +01:00
Sunli
f530d01bf4
Remove all attribute macros that can be replaced by derive.
2020-09-13 11:41:15 +08:00
Koxiaet
8796c5e1a7
Replace http::GQLRequest with Request
2020-09-12 17:07:46 +01:00
Koxiaet
1aa36819eb
Create resolver_utils
2020-09-12 10:29:52 +01:00
Sunli
a93b91ae2d
Re-enable the test on websocket.
2020-09-11 16:41:56 +08:00
Sunli
3e01ef0be7
Fix tests
2020-09-11 16:05:21 +08:00
Sunli
faac753096
Add transports::websocket module.
2020-09-11 15:54:56 +08:00
Sunli
553e6ffd53
Remove unnecessary Result on Schema::execute_stream function.
2020-09-11 10:47:55 +08:00
Sunli
c88747dfe4
Make all tests passed (async-graphql).
2020-09-10 19:35:48 +08:00
Sunli
7a90069cad
Continue to refactor.
2020-09-10 16:39:43 +08:00
Koxiaet
c42aa55625
Rustfmt
2020-09-08 09:30:29 +01:00
Koxiaet
ed5acdcf18
Support service parsing in async-graphql-parser
...
- Instead of adding a separate module `schema` like there was before,
since service parsing and executable parsing have a fair amount of
overlap I put them as two submodules `executable` and `service` in both
`parse` and `types`. Also, the grammar is unified under one `.pest`
file.
- Added const equivalents to `Value`, `Directive` etc
- Change the reexport `async_graphql::Value` from
`async_graphql_parser::types::Value` to
`async_graphql_parser::types::ConstValue` since in 99% of cases in this library
a const value is wanted instead of a value.
- Added consistent usage of executable/service instead of the ambiguous
query/schema.
- Some of the tests actually had invalid GraphQL so the new more correct
grammar made them fail, that was fixed.
- Added a `Name` newtype to refer to GraphQL names
(`[A-Za-z_][A-Za-z_0-9]*`) since they are used so frequently.
2020-09-08 09:21:27 +01:00
Koxiaet
9ad4e8c1a8
Merge branch 'master' into master
2020-09-06 07:20:18 +01:00
Koxiaet
3bf5f3a16c
Rustfmt
2020-09-06 07:16:36 +01:00
Koxiaet
e3e58d261d
Rewrite async-graphql-parser
2020-09-06 06:38:31 +01:00
Sunli
f87435b96c
Add test for multiple flatten attribute of InputObject.
2020-09-04 14:14:48 +08:00
Sunli
366c7c03da
Add flatten type field support for input objects. #255
2020-09-03 20:00:33 +08:00
Sunli
d04b5b675f
Fix the test code and add docs.
2020-09-01 09:10:12 +08:00
Koxiaet
945cd72869
Remove dependency on serde_derive, satisfy Clippy, improve docs
2020-08-31 19:18:02 +01:00
Sunli
80b2ff00c5
Implements Default for Schema.
2020-08-28 14:19:35 +08:00
Sunli
7fef4e3dca
Merge subscriptions #243
2020-08-27 15:35:48 +08:00
Sunli
01e3e85684
Add support for mut field args.
2020-08-17 21:48:53 +08:00
Sunli
fe336dd4d0
Fix send data with 'complete' WebSocket message. #238
2020-08-14 15:21:10 +08:00
Sunli
db8eef875c
Update test for MergedObject.
2020-08-11 09:37:33 +08:00
Sunli
d280a13b70
Add derive macro GQLMergeObject. #231
2020-08-10 14:11:46 +08:00
Sunli
d7248e149f
Add Default impl for MergedObject. #231
2020-08-10 10:47:30 +08:00
Sunli
dd7c64fc7a
Add MergedObject type. #231
2020-08-09 15:03:10 +08:00
Sunli
a193a8e51a
Add directive @ifdef
2020-08-06 14:52:54 +08:00
Sunli
b67278eeec
Add support for query execution over websocket.
2020-07-31 11:30:57 +08:00
Sunli
3d7594bac1
Removes code about streaming requests.
2020-07-31 10:10:03 +08:00
Sunli
3395c00603
Replace Value::Int and Value::Float with Value::Number.
2020-07-29 09:42:52 +08:00
Sunli
8992b681dc
Fix input validator is ignored when using variable #207
2020-07-11 10:05:30 +08:00
Sunli
9510160432
Add OutputJson type #203
2020-07-08 14:44:57 +08:00
Blaine Bublitz
6ed3909a9a
Use FieldResult for data(), add data_unchecked() for panic
2020-07-06 17:39:53 -07:00
Sunli
98e431fed0
Correct handling of raw identifiers #195
2020-07-02 10:25:20 +08:00
Blaine Bublitz
1c861ee80b
Fix issue with unwrapping derive attributes
2020-06-25 13:54:13 -07:00
Sunli
c8409e1a00
Remove ref
attribute for SimpleObject fields, and add owned
attribute.
2020-06-23 14:42:57 +08:00
Sunli
cda4498979
Remove all datasource-related code and update the documentation.
2020-06-15 14:17:19 +08:00
Sunli
c05127bb3e
Remove connection::DataSource
2020-06-15 12:06:15 +08:00
Bryan Burgers
81c7683e4d
Allow vars to be missing when def is nullable
...
Allow variables to be missing when the associated variable definition is
nullable (in which case we use `null` as the default).
This fixes queries like
```graphql
query Test($var: Int) {
test(var: $var)
}
```
```json
{}
```
which appear to be allowed according to the GraphQL spec.
2020-06-11 10:00:47 -05:00
Sunli
b605846822
Add GQLEnum, GQLInputObject, GQLSimpleObject macros. #164
...
use `proc_macro_derive` to solve the problem that Enum, InputObject, and SimpleObject do not support the #cfg attribute.
2020-06-11 11:23:23 +08:00
Sunli
f59d9f080f
Add tests for feature attribute
2020-06-06 11:49:29 +08:00
Sunli
73239b89be
Update PostGuard tests
2020-06-03 16:56:15 +08:00
Sunli
cfd652576f
Add PostGuard. #129
2020-06-03 14:50:06 +08:00
Sunli
27b622e8bc
Add connection::query function
2020-06-02 17:43:13 +08:00
Kevin Schoonover
80ff792f1a
Add input validator tests + fix clippy errors
2020-06-01 16:42:13 -05:00
Sunli
d932d30209
Fix incorrect variable substitution. #126
2020-05-31 11:54:07 +08:00
Sunli
778ff8d6e4
Update connection tests
2020-05-29 11:12:43 +08:00
Sunli
a336733616
Add Connection::try_append and Connection::try_append_stream
2020-05-29 09:24:31 +08:00
Sunli
18dacbdf17
Add MaybeUndefined type ( #123 )
...
* Add MaybeUndefined type
2020-05-28 15:00:55 +08:00
Sunli
dfe381b2e0
Fix the problem that async-graphql cannot be compiled and passed in rust nightly-2020-05-25. #122
2020-05-28 10:26:07 +08:00
Sunli
ada2597130
New data source ( #105 )
...
* New data source
2020-05-28 08:02:00 +08:00
Sunli
019580595c
Fixed a bug in fragment query. #114
2020-05-27 15:23:53 +08:00
Sunli
d703e5e4e1
Update input_validators.rs
2020-05-27 10:25:59 +08:00
Sunli
ae8234200a
Add the method parameter to the interface field. #112
2020-05-27 10:25:23 +08:00
Sunli
b1accc90e7
Compilation trouble with StringMinLength validator. #113
2020-05-27 09:42:58 +08:00
Sunli
42b6b0380f
Add some tests for default value
2020-05-27 09:27:59 +08:00
Sunli
a92a619345
Implement a type-safe default value definition for InputValue. #111
2020-05-26 20:43:53 +08:00
Samuel Hurel
2150fd4c38
Add proper count for Stream DataSource impl
2020-05-21 14:02:21 +02:00
Samuel Hurel
dc26996b05
Remove StreamDataSource wrapper
2020-05-21 13:10:36 +02:00
Samuel Hurel
36c05dc5a7
Fix tests & impl From<Stream> for StreamDataSource
2020-05-21 10:22:36 +02:00
Samuel Hurel
2e3cea7b74
Remove StreamDataSource mapping closure
2020-05-21 09:55:49 +02:00
Samuel Hurel
cc5bfa8350
Stream connection
2020-05-21 09:40:42 +02:00
Sunli
906bcce932
Remove Clone bound for Deferred and Streamed
2020-05-21 15:38:26 +08:00
Sunli
01489e20a5
Add StreamResponse type
2020-05-21 11:36:44 +08:00
Sunli
4868cf242b
Add @stream directive
2020-05-21 10:12:54 +08:00
sunli
a745667922
Add @defer support for actix-web
2020-05-20 20:10:40 +08:00
sunli
e949cb441c
Add defer tests
2020-05-20 13:42:55 +08:00
Sunli
d300e27fa2
Add Deferred type and @defer directive. #51
2020-05-19 20:53:29 +08:00
Sunli
89bfaac0eb
The scalar name and description attributes are placed on the process macro attributes. #97
2020-05-19 13:27:01 +08:00
Sunli
7ebd825feb
Sort __Schema.types and __Schema.directives by name. #93
2020-05-18 11:37:05 +08:00
Sunli
76b582065d
Support multiple lines of rustdoc as a type description.
2020-05-18 10:09:09 +08:00
krevativ
868be46647
Format introspection tests
2020-05-17 20:59:21 +02:00
krevativ
d7ea17d27b
Delete old test_introspection.rs file
2020-05-17 20:57:55 +02:00
krevativ
4edf27aa84
Add introspection tests
2020-05-17 20:55:40 +02:00
Sunli
a1c8dedd56
Merge pull request #75 from phated/interface-enums
...
Change interfaces & unions to require enums
2020-05-11 13:44:19 +08:00
Blaine Bublitz
548447cdec
Change Unions to enums instead of structs
2020-05-10 21:27:30 -07:00
Sunli
c101433b7c
Create a boilerplate test code for introspection. #66
2020-05-11 12:24:16 +08:00
Blaine Bublitz
9483ff14be
Fix tests
2020-05-10 20:25:49 -07:00
sunli
6d7d64866b
The error reason can be returned when the input value is parsed incorrectly. #70
2020-05-10 18:27:46 +08:00
sunli
da26857379
Move the parser to async-graphql-parser crate.
2020-05-09 22:02:55 +08:00
sunli
36967ffa4f
Add ability to forward field arguments to guard #59
2020-05-09 18:34:57 +08:00
sunli
311859e12a
Merge branch 'parser'
...
Implement a new GraphQL query parser and remove the dependency on graphql-parser.
2020-05-09 17:55:04 +08:00
sunli
d59f3acc50
Add tests to limit complexity and depth.
2020-05-05 13:46:56 +08:00
sunli
e3cab73d53
Modify the location of the Guard call.
2020-05-05 13:02:24 +08:00
sunli
0d32eaac75
Update default_value.rs
2020-05-04 13:26:13 +08:00
sunli
97464c4662
Create default_value.rs
2020-05-04 10:49:35 +08:00
sunli
79abc1c52e
Implement OutputType for FieldResult
2020-05-03 22:32:37 +08:00
sunli
f786ce3275
Stops when an error occurs to the subscription stream.
2020-05-03 21:21:54 +08:00
sunli
95c6c0bbf3
Report subscription stream errors to the client.
2020-05-03 16:02:46 +08:00
sunli
1a4189e3e0
Fixed a bug that caused the subscription request to fail to receive any messages. #45
2020-05-03 10:06:17 +08:00
sunli
4484d33f4e
Add some test
2020-05-03 09:12:14 +08:00
sunli
fded6fabcc
v1.10.1
2020-05-02 11:03:04 +08:00
sunli
98864c6879
Add field guard
2020-05-02 07:57:34 +08:00
sunli
1bc97de889
fix #33
2020-04-27 12:57:52 +08:00
sunli
3233f7e477
Update subscription test
2020-04-23 22:29:38 +08:00
sunli
d501f73a08
v1.9.17
2020-04-23 18:11:03 +08:00
sunli
998e9b7b85
Websocket transport creates context data from the connect_init.payload property
2020-04-23 14:52:22 +08:00
sunli
c73ae6a169
The subscriptions field supports a return value of type FieldResult
2020-04-23 11:26:36 +08:00
sunli
09624cab24
v1.9.11
...
Add context data for subscription
2020-04-23 10:26:16 +08:00
sunli
6dfa6a2614
Add some tests
2020-04-22 21:31:44 +08:00
sunli
ed9486c072
Clippy cleanup
2020-04-22 15:03:41 +08:00
sunli
6eb6c9cd9a
Fix interface resolver bug
2020-04-22 14:59:14 +08:00
Sunli
0f9285262b
Merge branch 'master' into interface-test
2020-04-22 13:39:07 +08:00
sunli
64d897a384
v1.9.9
2020-04-22 13:30:41 +08:00
Blaine Bublitz
a3ade99c24
Add failing interface test
2020-04-21 22:18:36 -07:00
sunli
73aef368df
Update interface.rs
2020-04-21 20:54:38 +08:00