You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Strip Value from to_output() function for GraphQL scalars (#1330)
- add `ToScalarValue` conversion trait
- `#[derive(GraphQLScalar)]` and `#[graphql_scalar]` macros:
- require `to_output()` function to return `ScalarValue` directly instead of `Value`
- support concrete and `impl Display` return types in provided `to_output()` function
- generate `ToScalarValue` implementation
- add non-required `from_displayable_non_static()` method to `ScalarValue` trait
- support top-level `#[value(from_displayable_non_static_with = ...)]` attribute in `#[derive(ScalarValue)]` macro
Copy file name to clipboardExpand all lines: book/src/types/scalars.md
+60-30Lines changed: 60 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,15 +85,49 @@ pub struct UserId(String);
85
85
In case we need to customize [resolving][7] of a [custom GraphQL scalar][2] value (change the way it gets executed), the `#[graphql(to_output_with = <fn path>)]` attribute is the way to do so:
Copy file name to clipboardExpand all lines: juniper/CHANGELOG.md
+10-1Lines changed: 10 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -93,6 +93,7 @@ All user visible changes to `juniper` crate will be documented in this file. Thi
93
93
-`From` and `Display` implementations are not derived anymore (recommended way is to use [`derive_more` crate] for this).
94
94
-`#[derive(GraphQLScalar)]` and `#[graphql_scalar]` macros:
95
95
- Made provided `from_input()` function to accept `ScalarValue` (or anything `FromScalarValue`-convertible) directly instead of `InputValue`. ([#1327])
96
+
- Made provided `to_output()` function to return `ScalarValue` directly instead of `Value`. ([#1330])
96
97
- Removed `LocalBoxFuture` usage from `http::tests::WsIntegration` trait. ([4b14c015])
97
98
98
99
### Added
@@ -112,18 +113,25 @@ All user visible changes to `juniper` crate will be documented in this file. Thi
112
113
-`IntoValue` and `IntoInputValue` conversion traits allowing to work around orphan rules with custom `ScalarValue`. ([#1324])
0 commit comments