847d09fb5e
- support `isRepeatable` field on directives - support `__Schema.description`, `__Type.specifiedByURL` and `__Directive.isRepeatable` fields in introspection
22 lines
617 B
Rust
22 lines
617 B
Rust
use juniper::graphql_scalar;
|
|
|
|
struct ScalarSpecifiedByUrl(i32);
|
|
|
|
#[graphql_scalar(specified_by_url = "not an url")]
|
|
impl GraphQLScalar for ScalarSpecifiedByUrl {
|
|
fn resolve(&self) -> Value {
|
|
Value::scalar(self.0)
|
|
}
|
|
|
|
fn from_input_value(v: &InputValue) -> Result<ScalarSpecifiedByUrl, String> {
|
|
v.as_int_value()
|
|
.map(ScalarSpecifiedByUrl)
|
|
.ok_or_else(|| format!("Expected `Int`, found: {}", v))
|
|
}
|
|
|
|
fn from_str<'a>(value: ScalarToken<'a>) -> ParseScalarResult<'a, DefaultScalarValue> {
|
|
<i32 as ParseScalarValue>::from_str(value)
|
|
}
|
|
}
|
|
|
|
fn main() {}
|