Skip to content

Commit f1d7988

Browse files
CLOUDP-271998: IPA-110: Pagination: APIs returning collections should provide pagination (Part 1)
1 parent e050b2d commit f1d7988

File tree

8 files changed

+493
-9
lines changed

8 files changed

+493
-9
lines changed

tools/spectral/ipa/__tests__/IPA104GetMethodReturnsSingleResource.test.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,22 @@ const componentSchemas = {
1111
},
1212
},
1313
PaginatedSchema: {
14-
type: 'array',
15-
},
16-
ArraySchema: {
14+
type: 'object',
1715
properties: {
16+
totalCount: {
17+
type: 'integer',
18+
},
1819
results: {
1920
type: 'array',
21+
items: {
22+
$ref: '#/components/schemas/Schema',
23+
},
2024
},
2125
},
2226
},
27+
ArraySchema: {
28+
type: 'array',
29+
},
2330
},
2431
};
2532

tools/spectral/ipa/__tests__/IPA105ListMethodResponseIsGetMethodResponse.test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ import { DiagnosticSeverity } from '@stoplight/types';
44
const componentSchemas = {
55
schemas: {
66
PaginatedResourceSchema: {
7+
type: 'object',
78
properties: {
9+
totalCount: {
10+
type: 'integer',
11+
},
812
results: {
913
type: 'array',
1014
items: {
@@ -17,7 +21,11 @@ const componentSchemas = {
1721
type: 'object',
1822
},
1923
PaginatedArraySchema: {
24+
type: 'object',
2025
properties: {
26+
totalCount: {
27+
type: 'integer',
28+
},
2129
results: {
2230
type: 'array',
2331
items: {
@@ -79,7 +87,11 @@ testRule('xgen-IPA-105-list-method-response-is-get-method-response', [
7987
content: {
8088
'application/vnd.atlas.2024-08-05+json': {
8189
schema: {
90+
type: 'object',
8291
properties: {
92+
totalCount: {
93+
type: 'integer',
94+
},
8395
results: {
8496
type: 'array',
8597
items: {
@@ -302,6 +314,10 @@ testRule('xgen-IPA-105-list-method-response-is-get-method-response', [
302314
'application/vnd.atlas.2024-08-05+json': {
303315
schema: {
304316
properties: {
317+
type: 'object',
318+
totalCount: {
319+
type: 'integer',
320+
},
305321
results: {
306322
type: 'array',
307323
items: {

0 commit comments

Comments
 (0)