graphql-spec icon indicating copy to clipboard operation
graphql-spec copied to clipboard

nit: add rate limit extension example

Open sbilello opened this issue 1 year ago • 6 comments

Add Rate Limit Extension Example

sbilello avatar Nov 06 '24 17:11 sbilello

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: sbilello / name: Sergio Bilello (3fba5918c7f4e89da73b9cbd481acf082d21ceec)

Deploy Preview for graphql-spec-draft ready!

Name Link
Latest commit 3fba5918c7f4e89da73b9cbd481acf082d21ceec
Latest deploy log https://app.netlify.com/sites/graphql-spec-draft/deploys/674909900080ff000850bb66
Deploy Preview https://deploy-preview-1125--graphql-spec-draft.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Nov 06 '24 17:11 netlify[bot]

Generally it's good practice to namespace the top fields in extensions to avoid conflicts, since the meaning is effectively granted to them by the entire ecosystem as a whole with no real governing documents/registry. For example, this rateLimit might be confused by some tooling with a different rateLimit format and result in errors. Instead: sb_rateLimit would be safer, or even extensions:{sb:{rateLimit:{...}}}.

Out of interest, what motivated this addition in particular?

benjie avatar Nov 07 '24 09:11 benjie

@benjie I've revised the example to better demonstrate how developers can implement rate-limiting using the extensions. Could you take a look please? Thanks

sbilello avatar Nov 12 '24 23:11 sbilello

I'm not convinced that the GraphQL spec needs an example of using the extensions property. I'll leave this open in case others feel otherwise.

benjie avatar Nov 21 '24 14:11 benjie

Thanks, @benjie! I fixed the json validation. I wanted to add an example to make sure that developers are aware about the difference between extensions for errors and extensions for not errors

sbilello avatar Nov 29 '24 00:11 sbilello