石墨烯的联合实现

graphene-federation的Python项目详细描述


石墨烯联合会

石墨烯的联合支持

构建:CircleCI

基于python graphene lib的联邦规范实现的草稿版本 https://www.apollographql.com/docs/apollo-server/federation/federation-spec/

风险自负

基于讨论:https://github.com/graphql-python/graphene/issues/953#issuecomment-508481652

现在支持:

  • sdl(服务字段)使得可以在联合中添加模式(原样)
  • @key decorator(实体支持)跨服务边界执行查询
  • 扩展扩展远程类型
  • 外部将字段标记为外部

TOdo实现:

  • @需要
  • @提供
importgraphenefromgraphene_federationimportbuild_schema,key@key(fields='id')# mark File as Entity and add in EntityUnion https://www.apollographql.com/docs/apollo-server/federation/federation-spec/#keyclassFile(graphene.ObjectType):id=graphene.Int(required=True)name=graphene.String()defresolve_id(self,info,**kwargs):return1defresolve_name(self,info,**kwargs):returnself.namedef__resolve_reference(self,info,**kwargs):# https://www.apollographql.com/docs/apollo-server/api/apollo-federation/#__resolvereferencereturnget_file_by_id(self.id)
importgraphenefromgraphene_federationimportbuild_schemaclassQuery(graphene.ObjectType):...passschema=build_schema(Query)# add _service{sdl} field in Query
importgraphenefromgraphene_federationimportexternal,extend@extend(fields='id')classMessage(graphene.ObjectType):id=external(graphene.Int(required=True))defresolve_id(self,**kwargs):return1

有关详细信息,请参见examples

或者最好检查integration_tests

与MongoEngine的集成也很酷example

供款:

运行测试:

  • make test
  • 如果更改了dockerfile或需求,请在make test之前运行make build

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
用于从特定供应商处查找java的vbscript VBS脚本   java如何向用户显示可编辑的结果?   nlp NER CRF,线程“main”java中的异常。lang.NoClassDefFoundError:org/slf4j/LoggerFactory   java将查询结果发送到spring boot中查看   java LIBGDX动画,无需enternig render()   在一个recyclerview中具有不同适配器的RecyclerViewWMergeadapter中的java搜索项   java在swing中创建具有多选功能的Jcombobox   java使用GSON计算JSON响应中的id   python如何在java中重载等式和打印?   运行emulator时,java Android studio 3.1未能加载aapt   在数组列表中存储多个字符串的java   多线程如何找到在java中成功完成的第一个线程的结果?   Android Studio/Gradle:为Java库模块设置Java目标版本   隐藏随机数确认java中的错误结果   java Android Studio 2.1