From 3fba5918c7f4e89da73b9cbd481acf082d21ceec Mon Sep 17 00:00:00 2001 From: Sergio Bilello Date: Thu, 7 Nov 2024 14:01:00 -0800 Subject: [PATCH] add custom namespace --- spec/Section 7 -- Response.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/spec/Section 7 -- Response.md b/spec/Section 7 -- Response.md index bd9448293..b4cd3aaa9 100644 --- a/spec/Section 7 -- Response.md +++ b/spec/Section 7 -- Response.md @@ -27,6 +27,41 @@ 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": { + "customNamespace": { + "requestRate": 2, + "remaining": 98, + "retryAfterMs": 0, + "resetAfterMs": 1985 + } + } +} +``` +Please note replace `customNamespace` with your customization. + 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.