Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 graphql 模式中定义了一个自定义标量类型:DateTime(基于 joda 时间库)。我在 Graphiql UI 架构定义和架构定义顶部的标量线中看到了这一点。
但是,我找不到将其作为参数包含在查询中的语法。
例如,我如何MyDateTimeType在下面的查询中发送值
MyDateTimeType
query { fetchData(key:"1", dateArg: MyDateTimeType) { field1 } }
实际上,这取决于 MyDateTimeType 的 coerceInput 方法是如何定义的。在我的例子中, coerceInput 有一个带有 StringValue 大小写的 match case 语句,所以当我向它传递一个 String 时它就起作用了。日期参数:“2019-05-30”