Skip to content

Commit 88c17db

Browse files
LegNeatotheduke
authored and
theduke
committed
Rename ScalarValue derive
Fixes #299.
1 parent d015a3c commit 88c17db

File tree

5 files changed

+6
-5
lines changed

5 files changed

+6
-5
lines changed

integration_tests/juniper_tests/src/custom_scalar.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use juniper::{execute, EmptyMutation, Object, RootNode, Variables};
99
use juniper::{InputValue, ParseScalarResult, ScalarValue, Value};
1010
use std::fmt;
1111

12-
#[derive(Debug, Clone, PartialEq, ScalarValue)]
12+
#[derive(Debug, Clone, PartialEq, GraphQLScalarValue)]
1313
enum MyScalarValue {
1414
Int(i32),
1515
Long(i64),

juniper/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# master
22

33
- The minimum required Rust version is now `1.30.0`.
4+
- The `ScalarValue` custom derive has been renamed to `GraphQLScalarValue`.
45

56
# [0.11.1] 2018-12-19
67

juniper/src/value/scalar.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub trait ParseScalarValue<S = DefaultScalarValue> {
1818
/// The main objective of this abstraction is to allow other libraries to
1919
/// replace the default representation with something that better fits thei
2020
/// needs.
21-
/// There is a custom derive (`#[derive(ScalarValue)]`) available that implements
21+
/// There is a custom derive (`#[derive(GraphQLScalarValue)]`) available that implements
2222
/// most of the required traits automatically for a enum representing a scalar value.
2323
/// This derives needs a additional annotation of the form
2424
/// `#[juniper(visitor = "VisitorType")]` to specify a type that implements
@@ -38,7 +38,7 @@ pub trait ParseScalarValue<S = DefaultScalarValue> {
3838
/// # use juniper::ScalarValue;
3939
/// # use std::fmt;
4040
/// #
41-
/// #[derive(Debug, Clone, PartialEq, ScalarValue)]
41+
/// #[derive(Debug, Clone, PartialEq, GraphQLScalarValue)]
4242
/// enum MyScalarValue {
4343
/// Int(i32),
4444
/// Long(i64),

juniper_codegen/src/derive_scalar_value.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub fn impl_scalar_value(ast: &syn::DeriveInput, is_internal: bool) -> TokenStre
88
let variants = match ast.data {
99
Data::Enum(ref enum_data) => &enum_data.variants,
1010
_ => {
11-
panic!("#[derive(ScalarValue)] may only be applied to enums, not to structs");
11+
panic!("#[derive(GraphQLScalarValue)] may only be applied to enums, not to structs");
1212
}
1313
};
1414

juniper_codegen/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub fn derive_object(input: TokenStream) -> TokenStream {
6161
gen.into()
6262
}
6363

64-
#[proc_macro_derive(ScalarValue)]
64+
#[proc_macro_derive(GraphQLScalarValue)]
6565
pub fn derive_scalar_value(input: TokenStream) -> TokenStream {
6666
let ast = syn::parse::<syn::DeriveInput>(input).unwrap();
6767
let gen = derive_scalar_value::impl_scalar_value(&ast, false);

0 commit comments

Comments
 (0)