fix(open-api): remove incorrect uuid format from pageInfo cursor fields
https://sonarly.com/issue/30216?type=bug
The OpenAPI specification for all list endpoints incorrectly declares `startCursor` and `endCursor` in `pageInfo` as `format: 'uuid'`, but the actual API returns base64-encoded JSON strings. This causes client code generators and validation tools to reject valid API responses.
Fix: Removed the incorrect `format: 'uuid'` annotation from `startCursor` and `endCursor` fields in the OpenAPI response schema definitions. The fix touches two functions in `responses.utils.ts`:
1. **`getFindManyResponse200`** (line 35-42): Changed cursor fields from `{ type: 'string', format: 'uuid' }` to `{ type: 'string' }`. This affects the OpenAPI spec for all list/findMany endpoints.
2. **`getFindDuplicatesResponse200`** (line 417-424): Same change for the findDuplicates endpoint response schema.
The actual API returns base64-encoded JSON cursors (e.g., `eyJpZCI6IjQ4MTQ4MjhhLWM3ZWEtNGVhZi04YmIxLThhODg2NmI0MWY4MiJ9`), not UUIDs. The `format: 'uuid'` was incorrectly added in commit c55dfbde6e during an OpenAPI cleanup — likely because the cursor's inner JSON payload contains a UUID, but the cursor string itself is a base64 wrapper. This mismatch caused client code generators and validation tools to reject valid API responses.
This commit is contained in:
@@ -32,14 +32,8 @@ export const getFindManyResponse200 = (
|
||||
type: 'object',
|
||||
properties: {
|
||||
hasNextPage: { type: 'boolean' },
|
||||
startCursor: {
|
||||
type: 'string',
|
||||
format: 'uuid',
|
||||
},
|
||||
endCursor: {
|
||||
type: 'string',
|
||||
format: 'uuid',
|
||||
},
|
||||
startCursor: { type: 'string' },
|
||||
endCursor: { type: 'string' },
|
||||
},
|
||||
},
|
||||
...(!fromMetadata && {
|
||||
@@ -414,14 +408,8 @@ export const getFindDuplicatesResponse200 = (
|
||||
type: 'object',
|
||||
properties: {
|
||||
hasNextPage: { type: 'boolean' },
|
||||
startCursor: {
|
||||
type: 'string',
|
||||
format: 'uuid',
|
||||
},
|
||||
endCursor: {
|
||||
type: 'string',
|
||||
format: 'uuid',
|
||||
},
|
||||
startCursor: { type: 'string' },
|
||||
endCursor: { type: 'string' },
|
||||
},
|
||||
},
|
||||
[`${item.nameSingular}Duplicates`]: {
|
||||
|
||||
Reference in New Issue
Block a user