{"section":"collections","title":"Collections & Pagination Rules","description":"Rules for collection responses and pagination","totalRules":3,"spectralRules":[{"name":"collection-response-structure","severity":"info","message":"Collection responses should wrap arrays in an object","description":"Validates that GET operations returning arrays use a wrapper object with value/data/items property","given":"$.paths[*].get.responses.200.content['application/json'].schema","then":{"function":"schema","functionOptions":{"schema":{"type":"object","required":["type"],"properties":{"type":{"const":"object"}}}}}},{"name":"pagination-param-names","severity":"info","message":"Pagination parameters should use standard names (limit, offset, cursor)","given":"$.paths[*].get.parameters[?(@.in=='query')]","then":{"field":"name","function":"enumeration","functionOptions":{"values":["limit","offset","cursor","page","pageSize","page_size","top","skip"]}}}],"rules":[{"id":"wrap-collections","requirement":"SHOULD","rule":"Collection responses should wrap arrays in an object","severity":"info","spectralRule":"collection-response-structure","rationale":"Enables adding metadata without breaking changes","examples":{"notRecommended":["[{\"id\": 1}, {\"id\": 2}]"],"recommended":["{\"value\": [{\"id\": 1}, {\"id\": 2}], \"totalCount\": 100}"]}},{"id":"standard-pagination-params","requirement":"SHOULD","rule":"Use standard pagination parameter names","severity":"info","spectralRule":"pagination-param-names","examples":{"recommended":["?limit=20&offset=40","?cursor=abc123"]}},{"id":"cursor-based-preferred","requirement":"SHOULD","rule":"Prefer cursor-based pagination over offset-based","severity":"info","rationale":"More reliable for large datasets and handles concurrent modifications"}]}