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
let ty:ExtendedType = ...;let arg:Option<&str> = ty.directives.get("directive_name").and_then(|directive| directive
.argument_by_name("arg").and_then(|arg| arg.as_str()));
It gets tedious when doing that for multiple directives with multiple arguments. Could we have a more automatic way of extracting directives and arguments?
As an example, if I had directive @dir(arg1: String! arg2: Number), could I do this:
#645 contains code for "input value coercion" (as part of execution) that returns a JSON map. "Deserializing" that map to a dedicated Rust struct definitely sounds interesting! It may be doable with derive(serde::Deserialize) a custom deserializer, but if we also want to type check the Rust struct definition against the GraphQL directive definition we may want a custom proc macro.
I often write code like this:
It gets tedious when doing that for multiple directives with multiple arguments. Could we have a more automatic way of extracting directives and arguments?
As an example, if I had
directive @dir(arg1: String! arg2: Number)
, could I do this:The text was updated successfully, but these errors were encountered: