Skip to content

Commit 54519bc

Browse files
CLOUDP-304938: Clarify pagination
1 parent 6a3912f commit 54519bc

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

tools/spectral/ipa/rulesets/IPA-105.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ rules:
4141
- Validation applies to List methods for resource collections only
4242
- Validation applies to json response content only
4343
- Validation ignores responses without schema and non-paginated responses
44+
- A response is considered paginated if it contains an array property named `results`
4445
- Validation ignores resources without a Get method
4546
- Paths with `x-xgen-IPA-exception` for this rule are excluded from validation
4647
message: '{{error}} http://go/ipa-spectral#IPA-105'

tools/spectral/ipa/rulesets/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ Validation checks that the List method response contains items property with ref
117117
- Validation applies to List methods for resource collections only
118118
- Validation applies to json response content only
119119
- Validation ignores responses without schema and non-paginated responses
120+
- A response is considered paginated if it contains an array property named `results`
120121
- Validation ignores resources without a Get method
121122
- Paths with `x-xgen-IPA-exception` for this rule are excluded from validation
122123

tools/spectral/ipa/rulesets/functions/utils/schemaUtils.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
*/
66
export function schemaIsPaginated(schema) {
77
const fields = Object.keys(schema);
8-
return fields.includes('properties') && Object.keys(schema['properties']).includes('results');
8+
return (
9+
fields.includes('properties') &&
10+
Object.keys(schema['properties']).includes('results') &&
11+
schema.properties.results.type === 'array'
12+
);
913
}
1014

1115
/**

0 commit comments

Comments
 (0)