Skip to content

Commit

Permalink
DOC Document maximumLimit in GraphQL schema (#329)
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Aug 17, 2023
1 parent 0161d55 commit 5b9afdd
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Expand Up @@ -64,6 +64,31 @@ isn't something we do in Silverstripe CMS. You can ignore `edges.node` and just
you want to.
[/notice]

#### Limiting pagination

To change the limit for items per page for a given type, you can set the `maximumLimit` property on the `paginateList` plugin in the schema:

**app/_graphql/models.yml**
```yaml
MyProject\Models\ProductCategory:
operations:
read:
plugins:
paginateList:
maximumLimit: 10
```

To change the default limit globally, set the max_limit configuration on the `PaginationPlugin` itself:

```yaml
SilverStripe\GraphQL\Schema\Plugin\PaginationPlugin:
max_limit: 10
```

[notice]
If you want to _increase_ the limit beyond the default value, you will also need to set a new `default_limit` configuration value on the `PaginationPlugin`.
[/notice]

#### Disabling pagination

Just set it to `false` in the configuration.
Expand Down
1 change: 1 addition & 0 deletions en/04_Changelogs/5.1.0.md
Expand Up @@ -128,6 +128,7 @@ SilverStripe\SessionManager\Models\LoginSession:
- The [`ListboxField`](api:SilverStripe\Forms\ListboxField) now has a react component, and can be used in react-powered contexts such as within elemental blocks
- A new [`FieldsValidator`](api:SilverStripe\Forms\FieldsValidator) class has been added, which simply calls [`validate()`](api:SilverStripe\Forms\FormField::validate()) on all data fields in the form to ensure fields have valid values. Functionally equivalent to an empty [`RequiredFields`](api:SilverStripe\Forms\RequiredFields) validator.
- A configuration option has been added to [`GarbageCollectionService`](api:SilverStripe\SessionManager\Services\GarbageCollectionService) to limit the number of items it removes each time you run garbage collection on session data. See [garbage collection](/developer_guides/cookies_and_sessions/managing_sessions/#garbage-collection) for more details.
- In your GraphQL schemas, you can now define the pagination limit at a schema level. See [limiting pagination](/developer_guides/graphql/working_with_dataobjects/query_plugins/#limiting-pagination) in the GraphQL documentation for more details.

## API changes

Expand Down

0 comments on commit 5b9afdd

Please sign in to comment.