Skip to content

Commit

Permalink
nit: add rate limit extension example
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio Bilello committed Oct 11, 2024
1 parent e546aac commit 2aae014
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions spec/Section 7 -- Response.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,39 @@ set, must have a map as its value. This entry is reserved for implementers to
extend the protocol however they see fit, and hence there are no additional
restrictions on its contents.

GraphQL Response for an extension with rate limit might look like this:

```json example
{
"data": {
"hero": {
"name": "R2-D2",
"heroFriends": [
{
"id": "1000",
"name": "Luke Skywalker"
},
{
"id": "1002",
"name": null
},
{
"id": "1003",
"name": "Leia Organa"
}
]
}
},
"extensions": {
"rateLimit": {
"requestRate": 2,
"remaining": 98,
"retryAfterMs": 0,
"resetAfterMs": 1985
}
}
}
```
To ensure future changes to the protocol do not break existing services and
clients, the top level response map must not contain any entries other than the
three described above.
Expand Down

0 comments on commit 2aae014

Please sign in to comment.