Feature Request: Shared "utility" types (distinct from boundary types) #232
Open
Description
There are a few types that I want to use consistently across all services, but which aren't "owned" by any specific service.
For example, I have a DateTime type defined as
type DateTime {
unix: Int!
format(layout: String! = "2006-01-02 15:04:05")
}
It doesn't make sense to give this an ID and make it a boundary type, since it's not "owned" by any particular service; there's simply a common library that defines the struct and resolver methods that we import and use in other resolvers.
If I just redefine it across multiple services, I get a "conflicting non boundary type" error. It'd be nice to define some utility
types that can appear and be identical across multiple services.
Two ways I can think of to do this:
- when merging, if two types are identical (same name, same fields, fields have the same types), choose either one as the merged type; if they differ, throw an error
- add a config option for a
shared.graphql
, a file with common type definitions that can be ignored in upstream services
but perhaps the project maintainers will have better ideas.
Metadata
Assignees
Labels
No labels