MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / checkPagination

Function checkPagination

scripts/lint-pagination-invariant.cjs:118–127  ·  view source on GitHub ↗

* Apply the invariant to a single pagination object. Returns the rule ID * when violated, or null. `cursor: null` is treated as present — the * spec's wire shape has the field absent on terminal pages, not present * with a null value. * * Asymmetry with `pagination-integrity.yaml`: the storyboa

(pagination)

Source from the content-addressed store, hash-verified

116 * tolerates — so don't "fix" one to match the other.
117 */
118function checkPagination(pagination) {
119 const hasCursor = Object.prototype.hasOwnProperty.call(pagination, 'cursor');
120 if (pagination.has_more === true && !hasCursor) {
121 return { rule: 'has_more_true_missing_cursor' };
122 }
123 if (pagination.has_more === false && hasCursor) {
124 return { rule: 'has_more_false_with_cursor' };
125 }
126 return null;
127}
128
129function lintSchemas(dir = SCHEMA_DIR) {
130 const violations = [];

Callers 3

lintSchemasFunction · 0.85
lintStoryboardsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected