sangria-graphql/sangria

Schema transformation

開放

#418 建立於 2018年11月12日

 (4 則留言) (0 個反應) (0 位負責人)Scala (219 個分叉)batch import
featurehelp wanted

倉庫指標

星標
 (1,961 顆星)
PR 合併指標
 (平均合併 8天 15小時) (30 天內合併 4 個 PR)

描述

The idea is to provide an easy and convenient way to transform existing schema. Since all types are cross-referenced within the schema, the whole schema needs to be re-created in a similar way as in the AST materializer where it re-creates existing types with the help of the builder.

In this case a dedicated builder might be useful as a low-level implementation detail. But it also would be nice to have a high-level DSL. Here is just an idea of how it might look like:

val newSchema =
  schema
    .mapObjectType("Book", _.rename("Publication"))
    .mapOutputTypes(_.filterFileds(field ⇒ !field.tags.contains(Preview)))

貢獻者指南