简体   繁体   English

解析不同服务中的同一实体

[英]Resolve Same Entity in Different Services

I have use-case where same entity type needs to resolved in multiple service, for example例如,我有需要在多个服务中解析相同实体类型的用例

Service A has type Post服务 A 的类型为Post

type Post{
   id: ID!
   title: String 
}

Service B has same type Post服务 B 具有相同类型的Post

type Post{
   id: ID!
   title: String
}

I have used apollo federation directive such us shareable , but still apollo couldn't able to compose a graph, how can i achieve this?我已经使用了 apollo federation directive such us shareable ,但 apollo 仍然无法组成图表,我该如何实现呢?

Have you read the documentation?你读过文档吗? You need to tag shared entities to tell apollo which one is extending which.您需要标记共享实体以告诉 apollo 哪个正在扩展哪个。 Read through this .通读这个 You said you've tried using shareable, but haven't provided an example.你说你试过使用可共享的,但没有提供例子。 Probably you've used it incorrectly but that can't be seen from what you've provided.可能您使用不当,但从您提供的内容中看不出。 You should also provide whichever error you got when apollo failed to build a schema.您还应该提供当 apollo 未能构建模式时遇到的任何错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM