graphql-union-input-type
JSON →Provides a GraphQL union input type for graphql-js, enabling mutations to accept polymorphic input via a single field with type discrimination. Version 0.4.0 is the latest stable release; the package has minimal maintenance. It works by wrapping multiple GraphQLInputObjectType definitions and resolving the concrete type based on a key field, a resolveType function, or AST/value inspection. Unlike core GraphQL, which forbids unions/interfaces on input types, this library allows flexible mutation inputs without manual AST traversal, but requires careful handling of typeKey or resolveType to avoid validation errors.
Resources
packagegraphql-union-input-type ↗