reactioncommerce / federated-gateway

An access aware federated GraphQL API gateway for the Reaction Commerce ecosystem
Apache License 2.0
6 stars 3 forks source link

[DISCUSSION] Type Namespacing/Collision #25

Open nnnnat opened 4 years ago

nnnnat commented 4 years ago

If two federated services register a type, query, or mutation with the same name, the gateway errors out upon startup. Issue for this: apollographql/apollo-server#3186.

Colliding scalars work as of apollographql/apollo-server#2767.

We have come up with multiple decisions and chose to manually prefix our services with namespaces, as exemplified in the issue @kieckhafer linked above. Although the other solutions are not acceptable for us, we will be writing up a decision record for this choice.

kieckhafer commented 4 years ago

https://github.com/reactioncommerce/reaction-authorization/pull/132

rosshadden commented 4 years ago

OP: If two federated services register a type, query, or mutation with the same name, the gateway errors out upon startup. Issue for this: https://github.com/apollographql/apollo-server/issues/3186.

Colliding scalars work as of https://github.com/apollographql/apollo-server/issues/2767.

We have come up with multiple decisions and chose to manually prefix our services with namespaces, as exemplified in the issue @kieckhafer linked above. Although the other solutions are not acceptable for us, we will be writing up a decision record for this choice.

ticean commented 4 years ago

@rosshadden @kieckhafer the description for this issue is blank. Could you provide specific details for why we're getting collisions? Is that generalizable? I'll describe below but I'm not sure I understood the "why" behind #132.

I read #132 and made some suggestions, to which @eric replied:

I do favor the way some of your suggestions look and sound, but think it would make it easier to duplicate these policies in the future across multiple services if they aren't prefixed in a specific way, like with a plugin name.

I agree with the comment. I wasn't suggesting to prefix with a plugin name. I thought the problem is that the authorization service is introducing a new type of policy. The new policy is different from a previously existing Reaction API Policy (which i assumed was a Meteor policy), so we needed to give the new type a better, more specific name like AuthorizationPolicy. If that PR is merged, we'll have two different types in the GraphQL schema, Policy and AuthorizationPolicy. They represent different resources and have different attributes.

Did I miss the :boat:?