Directive Definitiondirective @HttpJsonDataSource ("""the host of the origin"""host: String!"""the url of the origin"""url: String!"""the HTTP method the client should use for the request, defaults to GET"""method: HTTP_METHOD = GET"""parameters"""params: [Parameter]) on FIELD_DEFINITION
This directive lets you define how to fetch data for the attached field.
Example usagetype Query {post(id: Int!): JSONPlaceholderPost@HttpJsonDataSource(host: "jsonplaceholder.typicode.com"url: "/posts/{{ .id }}"params: [{name: "id"sourceKind: FIELD_ARGUMENTSsourceName: "id"variableType: "Int!"}])}
Example Query{post(id: 1) {idname}}
This query will internally resolve the following URL: https://jsonplaceholder.typicode.com/posts/1
The field argument with name "id" will be used to "render" the url template using golang templating syntax.