@globalSource directive
The @globalSource directive remaps a field to another field by path (absolute in the JSON fragment).
Arguments
path- The JSON global path for field value search. This argument support the specifications of JsonPath. For more information about JsonPath, refer to https://github.com/json-path/JsonPath.
Examples
- Content
-
{ "Page": { "Article": { "body": { "content": "test content", "image": "image" }, "header": "content header" } } } - Model
-
type Page { article: Article } type Article { body: Body } type Body { content : String image : String header : String @globalSource(path: "$.Article.header") } - Query
-
{ getContent() { Page { Article { body { header } } } } } - Result
-
{ "Page": { "Article": { "body": { "header": "content header" } } } }