gramps-graphql / gramps--legacy

The core data source combination engine of GrAMPS.
https://gramps.js.org
MIT License
197 stars 13 forks source link

Type namespace prefixes #67

Open kbrandwijk opened 6 years ago

kbrandwijk commented 6 years ago

One of the main reasons that different datasources play well together is that they use different prefixes for their types. However, this is neither enforced nor validated. I would like GrAMPS to apply the namespace of the datasource to my types itself, instead of having to do this myself for every type. I think this would make individual datasources a lot more readable, and given that they are always supposed to be processed through GrAMPS, it seems logical that GrAMPS would be in charge of managing those namespaces.

I don't know if there are cases where you explicitly don't want types to be prefixed. If that's the case, then this proposal wouldn't work. In that case, I would some form of validation, instead of depending on mergeSchemas to throw an error.

grxy commented 6 years ago

@kbrandwijk One of the things I have in my test suites of my GrAMPS server is a check that each of the data sources has a unique namespace. While I see where this sentiment is coming from, I think this solution results in too much magic being done by GrAMPS itself. At the very least, I would argue that if this were to be implemented, it should be opt-in, not opt-out, since I think that many dev teams would want tight control of their GraphQL type names.