Skip to content

fix: correct REST collection response shape and count property names - #206

Open
daogrady wants to merge 4 commits into
mainfrom
fix/rest-collection-response-shape
Open

daogrady wants to merge 4 commits into
mainfrom
fix/rest-collection-response-shape

Conversation

@daogrady

@daogrady daogrady commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

(partially) fixes CS20260013358977

specifically:

Protocol/request | Generated OpenAPI spec | Actual server response
---------------- | ---------------------- | ------------------------
REST collection without $count=true | Object with value | Bare JSON array
REST collection with $count=true | Object with value and @count | Object with value and count
REST expansion with $count=true | books@count | books@odata.count

CAP REST returns two distinct shapes depending on $count: a bare array without it, or {count, value} with it. OpenAPI cannot condition a response schema on a query parameter value, so document both via oneOf.

This behaviour was confirmed to be working as intended by @vkozyura.

@daogrady
daogrady force-pushed the fix/rest-collection-response-shape branch from 1b98fd7 to 88fb2e6 Compare October 14, 2026 08:45
CAP REST returns two distinct shapes depending on $count: a bare array
without it, or {count, value} with it. OpenAPI cannot condition a
response schema on a query parameter value, so document both via oneOf.

Also fixes the count property name for REST (count, not @count) and
aligns nav-property expansion count with the OData fix (@odata.count).
@daogrady
daogrady force-pushed the fix/rest-collection-response-shape branch from 88fb2e6 to d51ddc3 Compare October 14, 2026 09:00
@daogrady
daogrady marked this pull request as ready for review October 16, 2026 12:28
@daogrady
daogrady requested a review from tim-sh October 16, 2026 12:28

@tim-sh tim-sh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should look good if the conflict resolution leaves only the REST oneOf change, which is the actual goal here.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants