GraphQL Union and Input Type?

梦想的初衷 提交于 2019-11-30 00:41:04

问题


Is it possible in GraphQL to have an input type that is also a union?

Something like:

const DynamicInputValueType = new GraphQLUnionType({
  name: 'DynamicInputType',
  types: [GraphQLString, GraphQLFloat, GraphQLInt]
})

but also able to be used as a input for a mutation?


回答1:


As of September 2017, this is not possible. There is an ongoing discussion around this functionality.




回答2:


There is a npm module. I haven't tested. https://www.npmjs.com/package/graphql-union-input-type



来源:https://stackoverflow.com/questions/45288955/graphql-union-and-input-type

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!