Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add docs for call operator #102

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions docs/operators/call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
title: "@call"
---

The **@call** operator is used to reference an `@http` operator. It is useful when you have multiple fields that resolves from the same HTTP endpoint.

```graphql showLineNumbers
schema {
query: Query
}

type Query {
posts: [Post] @http(path: "/posts")
user(id: Int!): User @http(path: "/users/{{args.id}}")
}

type User {
id: Int!
name: String!
username: String!
email: String!
}

type Post {
id: Int!
userId: Int!
title: String!
body: String!
user: User @call(query: "user", args: [{key: "id", value: "{{value.userId}}"}])
}
```

## query

The name of the field that has the `@http` resolver to be called. It is required.

```graphql showLineNumbers
type Post {
userId: Int!
user: User @call(query: "user", args: [{key: "id", value: "{{value.userId}}"}])
}
```

## args

The arguments to be passed to the `@http` resolver. It is optional.

```graphql showLineNumbers
type Post {
userId: Int!
user: User @call(query: "user", args: [{key: "id", value: "{{value.userId}}"}])
}
```
Loading