Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
core/features/jsonapi/pagination.feature at main · phpc/core · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
See all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
phpc
core
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
core
/
features
/
jsonapi
/
pagination.feature
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
42 lines (36 loc) · 2.11 KB
main
Breadcrumbs
core
/
features
/
jsonapi
/
pagination.feature
Copy path
Top
File metadata and controls
Code
Blame
42 lines (36 loc) · 2.11 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Feature
:
JSON API pagination handling
In order to be able to handle pagination
As a client software developer
I
need to retrieve an JSON API pagination information as metadata and links
Background
:
Given
I add
"Accept"
header equal to
"application/vnd.api+json"
And
I add
"Content-Type"
header equal to
"application/vnd.api+json"
@createSchema
Scenario
:
Get the first page of a paginated collection according to basic config
Given
there are 10 dummy objects
When
I send a
"GET"
request to
"/dummies"
Then
the response status code should be 200
And
the JSON should be valid according to the JSON API schema
And
the JSON node
"data"
should have 3 elements
And
the JSON node
"meta.totalItems"
should be equal to the number 10
And
the JSON node
"meta.itemsPerPage"
should be equal to the number 3
And
the JSON node
"meta.currentPage"
should be equal to the number 1
Scenario
:
Get the fourth page of a paginated collection according to basic config
When
I send a
"GET"
request to
"/dummies?page[page]=4"
Then
the JSON should be valid according to the JSON API schema
And
the JSON node
"data"
should have 1 elements
And
the JSON node
"meta.currentPage"
should be equal to the number 4
Scenario
:
Get a paginated collection according to custom items per page in request
When
I send a
"GET"
request to
"/dummies?page[itemsPerPage]=15"
Then
the response status code should be 200
And
the JSON should be valid according to the JSON API schema
And
the JSON node
"data"
should have 10 elements
And
the JSON node
"meta.totalItems"
should be equal to the number 10
And
the JSON node
"meta.itemsPerPage"
should be equal to the number 15
And
the JSON node
"meta.currentPage"
should be equal to the number 1
Scenario
:
Get an error when provided page number is not valid
When
I send a
"GET"
request to
"/dummies?page[page]=0"
Then
the response status code should be 400
Scenario
:
Get an error when provided page number is too large
When
I send a
"GET"
request to
"/dummies?page[page]=9223372036854775807"
Then
the response status code should be 400
You can’t perform that action at this time.