-
Notifications
You must be signed in to change notification settings - Fork 574
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
feat: allow extra params in body #3333
Conversation
🦋 Changeset detectedLatest commit: b1bfc8a The changes in this PR will be included in the next version bump. This PR includes changesets to release 23 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
💻 Website PreviewThe latest changes are available as preview in: https://c12ca00c.graphql-yoga.pages.dev |
✅ Benchmark Results
|
Apollo Federation Subgraph Compatibility Results
Learn more: |
🚀 Snapshot Release (
|
Package | Version | Info |
---|---|---|
@graphql-yoga/apollo-link |
3.5.0-alpha-20240628224657-b1bfc8af |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/urql-exchange |
3.5.0-alpha-20240628224657-b1bfc8af |
npm ↗︎ unpkg ↗︎ |
graphql-yoga |
5.5.0-alpha-20240628224657-b1bfc8af |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/nestjs |
3.5.0-alpha-20240628224657-b1bfc8af |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/nestjs-federation |
3.5.0-alpha-20240628224657-b1bfc8af |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/plugin-apollo-inline-trace |
3.5.0-alpha-20240628224657-b1bfc8af |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/apollo-managed-federation |
0.2.0-alpha-20240628224657-b1bfc8af |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/plugin-apq |
3.5.0-alpha-20240628224657-b1bfc8af |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/plugin-csrf-prevention |
3.5.0-alpha-20240628224657-b1bfc8af |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/plugin-defer-stream |
3.5.0-alpha-20240628224657-b1bfc8af |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/plugin-disable-introspection |
2.5.0-alpha-20240628224657-b1bfc8af |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/plugin-graphql-sse |
3.5.0-alpha-20240628224657-b1bfc8af |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/plugin-jwt |
2.5.0-alpha-20240628224657-b1bfc8af |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/plugin-persisted-operations |
3.5.0-alpha-20240628224657-b1bfc8af |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/plugin-prometheus |
5.2.0-alpha-20240628224657-b1bfc8af |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/plugin-response-cache |
3.7.0-alpha-20240628224657-b1bfc8af |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/plugin-sofa |
3.5.0-alpha-20240628224657-b1bfc8af |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/render-graphiql |
5.5.0-alpha-20240628224657-b1bfc8af |
npm ↗︎ unpkg ↗︎ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As said in slack, I would prefere to give access to the extra params in a seperate ctx field.
}); | ||
|
||
console.assert(res.status === 200); | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also add this to the normal documentation?
Maybe a section called "Request customization", where we show this and also how you can set a custom GraphQL request parser?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0203957
What do you think?
@EmrysMyrddin why? |
@@ -402,6 +402,26 @@ describe('requests', () => { | |||
expect(body.errors?.[0].message).toBe('Unexpected parameter "test" in the request body.'); | |||
}); | |||
|
|||
it('does not error if there is a specified invalid parameter in the request body', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also add a test of having a field that's not specified in the extraParamNames
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! Done!
5f07980
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approved, bit lets add also some basic documentation
0203957
to
8b8684e
Compare
1405e9b
to
2d04aeb
Compare
By default, Yoga does not allow extra parameters in the request body other than
query
,operationName
,extensions
, andvariables
, then throws 400 HTTP Error.This change adds a new option called
extraParamNames
to allow extra parameters in the request body.