Commit graph

235 commits

Author SHA1 Message Date
Audun Halland
c54137f7b4
Rework look-ahead machinery as lazy-evaluated (#1212)
- make `LookAheadValue::List` to contain new iterable `LookAheadList` type
- make `LookAheadValue::Object` to contain new iterable `LookAheadObject` type
- remove `LookAheadMethods` trait and redundant `ConcreteLookAheadSelection` struct making all APIs accessible as inherent methods on `LookAheadSelection` and `LookAheadChildren` decoupled types
- move `LookAheadMethods::child_names()` to `LookAheadChildren::names()`
- move `LookAheadMethods::has_children()` to `LookAheadChildren::is_empty()`
- move `LookAheadMethods::select_child()` to `LookAheadChildren::select()`
- move `LookAheadSelection::for_explicit_type()` to `LookAheadSelection::children_for_explicit_type()`
- make `LookAheadSelection::arguments()` returning iterator over `LookAheadArgument`
- make `LookAheadSelection::children()` returning `LookAheadChildren`

Co-authored-by: Kai Ren <tyranron@gmail.com>
2024-01-16 19:17:07 +00:00
tyranron
df24749727
Update copyright notices to 2024 year 2024-01-02 15:59:19 +01:00
Kai Ren
9420f3c19e
Allow top-level #[graphql] attribute in attribute macros (#1232) 2023-12-11 20:31:04 +00:00
tyranron
3645df27b6
Stop Clippy from enforcing # Errors and # Panics sections in GraphQL descriptions 2023-11-17 21:38:17 +01:00
dependabot[bot]
782eccba47
Upgrade syn crate to 2.0 version (#1157)
- replace `proc-macro-error` crate with simplified `common::diagnostic::pollyfill`
- migrate `juniper_codegen_tests` to stable Rust

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kai Ren <tyranron@gmail.com>
2023-11-01 19:00:05 +01:00
tyranron
17a02fa766
Correct fully qualified paths in generated code (#1195, #1194) 2023-10-13 19:28:42 +03:00
Peter Holloway
801820a3b6
Use fully qualified paths in generated code (#1195)
If user code has a type alias (or custom type) called `Result` or
`Option` etc, this would be used instead of the intended standard
library types causing surprising compile errors from generated code.

Using the fully qualified path allows the generated code to be isolated
from user types.

Includes two basic regression tests covering `Result` and `Send`.

Fixes #1194
2023-10-06 11:59:00 -07:00
tyranron
6aa6385437
Bump up MSRV to 1.65.0 2022-12-19 09:31:23 +01:00
tyranron
3a68877de0
Tune up for 1.65 Rust 2022-11-04 19:05:09 +01:00
Kai Ren
f3df70693c
Improve CI (#1113)
- switch to `dtolnay/rust-toolchain` GitHub action
- restore release Git tag format and correct `cargo-release` integration
- enable MSRV check
- integrate `cargo-careful`
2022-10-21 16:07:17 +00:00
tyranron
e9482c3f18
Fix codegen tests for latest nightly Rust 2022-08-29 17:10:40 +03:00
tyranron
0df1e448e8
Tune up for 1.63 Rust 2022-08-12 17:03:06 +03:00
tyranron
b32c54eeaa
Mention #113 in CHANGELOG 2022-07-26 11:42:44 +03:00
tyranron
ef7a7e8229
Upgrade to 2021 Rust edition
- set 1.62 Rust as MSRV
- use new fmt syntax where possible
- refactor `.to_owned()`, `.to_string()` and `.into()` usage
- rename `IntoResolvable::into()` as `IntoResolvable::into_resolvable()` to disambiguate with `Into::into()`
- use `#[derive(Default)]` for enums where possible
- use `bool::then_some()` where possible
2022-07-13 15:20:10 +02:00
tyranron
576d6fb6dd
Finish refactoring juniper_codegen crate 2022-07-11 17:06:05 +02:00
ilslv
0c8bcf582f
Fix input value coercion with defaults (#1080, #1073) 2022-07-08 21:55:51 +00:00
Benno Tielen
5332db0a4b
Strip lifetime parameter from ParseError (#1081, #528)
- replace `Token` with its string representation in `ParseError`
- strip lifetime parameter from `GraphQLError`, `GraphQLResponse` and `GraphQLBatchResponse`

Co-authored-by: Kai Ren <tyranron@gmail.com>
2022-07-08 18:21:23 +00:00
ilslv
a32140cd46
Update all links to October 2021 spec (#1075, #1000)
Co-authored-by: Kai Ren <tyranron@gmail.com>
2022-06-28 15:32:08 +00:00
ilslv
927e42201a
Rework #[derive(GraphQLInputObject)] macro implementation (#1052)
Co-authored-by: Kai Ren <tyranron@gmail.com>
2022-06-28 11:27:28 +00:00
ilslv
9ca2364bfe
Allow interfaces to implement other interfaces (#1028, #1000) 2022-06-27 12:09:44 +00:00
ilslv
26d9daaadf
Rework #[derive(GraphQLEnum)] macro implementation (#1047) 2022-06-24 21:57:52 +03:00
tyranron
d6f5cee8b3
Satisfy rust_2018_idioms rustc lint in generated code 2022-05-12 14:33:03 +03:00
tyranron
6b3898b077
Add docs for enum generated by #[graphql_interface] and #[derive(GraphQLInterface)] macros 2022-05-11 20:35:17 +03:00
tyranron
ba1ed85b3c
Relax object safety requirement for GraphQLValue and GraphQLValueAsync traits 2022-04-19 16:33:10 +03:00
Cerber-Ursi
c40d80f26b
Fix expansion of procedural macros inside macro_rules! (#1054, #1051) 2022-04-13 16:15:50 +03:00
Kai Ren
72ed45a77c
Rework CI and project toolchain (#1043)
- remove `cargo-make` integration
- rework CI pipeline more granular and precise
- rework releasing process
- tune up project layout
- fill up new CHANGELOGs

Additionally:
- fix latest nightly/stable Rust inconsistencies
2022-04-08 17:44:50 +03:00
ilslv
d0b56f9222
Implement #[derive(GraphQLInterface)] to use structs as GraphQL interfaces (#1026)
- support `#[graphql_interface]` on structs
2022-04-01 21:10:45 +03:00
tyranron
4182a8cf2b
Fix tests for 1.0.90 syn version 2022-03-29 12:28:25 +03:00
ilslv
5bbc73ad89
Redesign #[derive(ScalarValue)] macro to derive ScalarValue on enums (#1025) 2022-03-03 15:49:35 +02:00
ilslv
0ebd19af5a
Redesign #[derive(GraphQLScalar)] and #[graphql_scalar] macros (#1017)
- `#[derive(GraphQLScalar)]`:
    - support generic scalars
    - support structs with single named field
    - support for overriding resolvers
- `#[graphql_scalar]`:
    - support `transparent` argument

Co-authored-by: Kai Ren <tyranron@gmail.com>
2022-02-28 11:34:38 +02:00
ilslv
63198cdfcb
Redesign #[graphql_scalar] macro (#1014, #1000)
- support generic scalars
- make it applicable to type aliases and struct/enums/unions
2022-02-24 17:12:17 +02:00
tyranron
77d4c90b23
Bump up juniper and juniper_codegen version to 0.16.0-dev to disambiguate release automation on CI 2022-02-02 20:08:41 +02:00
tyranron
589acb5a7b
Merge security fixes from 0.15 juniper releases 2022-02-02 19:37:24 +02:00
tyranron
855137cde6
Release juniper 0.15.9 2022-02-02 18:33:41 +02:00
tyranron
a0a566bc5b
Release juniper_codegen 0.15.9 2022-02-02 18:28:30 +02:00
Christian Legnitto
3025ab0a4a Release juniper 0.15.8 2022-01-26 23:28:49 -08:00
Christian Legnitto
1fd518e72c Release juniper_codegen 0.15.8 2022-01-26 23:28:15 -08:00
Christian Legnitto
4b0aabe9f6 More breaking changes with cargo-release 0.19.0 2022-01-26 23:21:46 -08:00
Christian Legnitto
399a79056a Update key for newer cargo-release 2022-01-26 22:47:29 -08:00
ilslv
1aa1000c3b
Redesign #[graphql_interface] macro (#1009, #1000, #814)
- remove support for `#[graphql_interface(dyn)]`
- describe all interface trait methods with type's fields or impl block instead of `#[graphql_interface]` attribute on `impl Trait`
- forbid default impls on non-skipped trait methods
- support additional nullable arguments on implementer
- support returning sub-type on implementer
2022-01-26 20:58:53 +02:00
ilslv
847d09fb5e
Support @specifiedBy(url: "...") directive via specified_by_url attribute argument in #[graphql_scalar] and #[derive(GraphQLScalarValue)] macros (#1003, #1000)
- support `isRepeatable` field on directives
- support `__Schema.description`, `__Type.specifiedByURL` and `__Directive.isRepeatable` fields in introspection
2021-12-20 13:36:27 +02:00
Kai Ren
46be97ada4
Refactor FromInputValue to return Result instead of Option (#987)
- propagate `FromInputValue` conversion errors during validation
- replace panics with errors during resolving

Co-authored-by: ilslv <ilya.solovyiov@gmail.com>
2021-12-14 19:30:27 +02:00
Kai Ren
f66296d618
Replace ScalarValue::Visitor with DeserializeOwned requirement (#985)
- remove `Serialize` impl from `#[derive(GraphQLScalarValue)]` macro expansion
2021-10-11 21:53:04 +03:00
nickelc
b9257ef7d4
Fix Clippy warnings (#980) 2021-09-12 20:38:41 +03:00
Kai Ren
a3fda7363d
Rework codegen for GraphQL objects and subscriptions (#971, #421)
- preserve and reuse defined impl blocks in #[graphql_object] and #[graphql_subscription] macros expansion
- allow renaming `ScalarValue` type parameter in expanded code via `scalar = S: ScalarValue` syntax

Additionally:
- rename `rename` attribute's argument to `rename_all`
- support `rename_all` in #[graphql_interface] macro
2021-08-11 17:41:49 +03:00
Kai Ren
39d1e43420
Allow using Rust arrays as GraphQL lists (#918) (#966)
* Provide impls for arrays

* Remove redundant Default bound

* Recheck other places of mem::transmute usage

* Fix missing marker impls

* Extend GraphQL list validation with optional expected size

* Improve input object codegen

* Cover arrays with tests

* Add CHANGELOG entry

* Consider panic safety in FromInputValue implementation for array

* Tune up codegen failure tests
2021-07-23 14:51:47 -10:00
tyranron
ad64025572
Strip redundant fields in codegen producing warnings 2021-07-21 18:16:29 +03:00
Christian Legnitto
88b10fe009 Release juniper 0.15.7 2021-07-08 00:01:56 -07:00
Christian Legnitto
f50ef5dfaa Release juniper_codegen 0.15.7 2021-07-08 00:00:55 -07:00
Christian Legnitto
28c116411d
Switch releasing commands from a blocklist to an allowlist (#956)
* Switch releasing commands from a blocklist to an allowlist

This is much better as we can hardocde the crates to filter out in
one place, can selectively release certain crates easily,
and only have one command instead of the "-some" hack

* get rid of workaround no longer needed

* More makefiles
2021-07-07 23:47:16 -07:00