-
-
Notifications
You must be signed in to change notification settings - Fork 541
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(relay): Allow to customize max_results per connection in relay (#…
- Loading branch information
1 parent
1e0e1ef
commit ef27874
Showing
6 changed files
with
122 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Release type: minor | ||
|
||
Add the ability to override the "max results" a relay's connection can return on | ||
a per-field basis. | ||
|
||
The default value for this is defined in the schema's config, and set to `100` | ||
unless modified by the user. Now, that per-field value will take precedence over | ||
it. | ||
|
||
For example: | ||
|
||
```python | ||
@strawerry.type | ||
class Query: | ||
# This will still use the default value in the schema's config | ||
fruits: ListConnection[Fruit] = relay.connection() | ||
|
||
# This will reduce the maximum number of results to 10 | ||
limited_fruits: ListConnection[Fruit] = relay.connection(max_results=10) | ||
|
||
# This will increase the maximum number of results to 10 | ||
higher_limited_fruits: ListConnection[Fruit] = relay.connection(max_results=10_000) | ||
``` | ||
|
||
Note that this only affects `ListConnection` and subclasses. If you are | ||
implementing your own connection resolver, there's an extra keyword named | ||
`max_results: int | None` that will be passed to it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters