Skip to content

Commit 51a3600

Browse files
committed
refactor(v2-api)!: flatten the single-resource response envelope
BREAKING: 31 endpoints that returned `{ data: { <resource>: T } }` now return `{ data: T }`. This corrects drift, not a design decision. PR #5273 added skills, custom tools, MCP servers, secrets, and knowledge nested while adding workflows, files, and logs flat — and in the same commit wrote the `v2/shared.ts` docblock declaring `single resource: { data: T }` is the standard. The nested half appears to have been modelled on the v2 tables surface (#6067), which landed twelve days earlier. Lists were already `{ data: T[], nextCursor }`, so flat single-resource is what actually matches them; nesting made every client destructure a layer that carries nothing. Doing it now because the cost only grows: `v2-api` is still dark-launched, so today this breaks no one. After GA it needs a deprecation window. Payloads that carry real information were deliberately left alone — this was a classification exercise, not a mechanical sweep. Unchanged: delete acknowledgements (`{ id, deleted }`, `{ path, deleted, deletedItems }`), the knowledge search envelope (which echoes query, knowledgeBaseIds, topK and totalResults alongside hits), upload payloads carrying signed tokens and transfer instructions, bulk-operation counts, `{ row, operation }` upserts, named acknowledgement scalars (`{ dispatchId }`, `{ cancelled }`), and `{ columns: [...] }` — a collection, where a bare `{ data: T[] }` would be indistinguishable from the list envelope but without `nextCursor`. Also flattened the two file-share responses, which were not in the original survey: leaving them would have put one resource in two shapes on one path. `GET /files/{id}/share` now returns `{ "data": null }` when a file has never been shared. No consumer is affected. Both SDKs touch exactly two v2 endpoints — execute and run status — and both were already flat. No docs MDX, client hook, or internal caller reads a changed response; Copilot table tools call the application use cases directly rather than the HTTP surface. The shared `v2FolderSchema` is untouched: every folder flatten was achievable at the response site, which is itself evidence flat was the intended shape.
1 parent c36d7e4 commit 51a3600

50 files changed

Lines changed: 323 additions & 734 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/docs/openapi-v2-files-audit.json

Lines changed: 24 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -3130,10 +3130,10 @@
31303130
"title": "Move files request",
31313131
"description": "Files and destination selected for a bulk move."
31323132
},
3133-
"V2GetFileShareResult": {
3133+
"V2GetFileShareResponse": {
31343134
"type": "object",
31353135
"properties": {
3136-
"share": {
3136+
"data": {
31373137
"anyOf": [
31383138
{
31393139
"$ref": "#/components/schemas/V2FileShare"
@@ -3142,20 +3142,7 @@
31423142
"type": "null"
31433143
}
31443144
],
3145-
"description": "Current public share, or null when the file has never been shared."
3146-
}
3147-
},
3148-
"required": ["share"],
3149-
"additionalProperties": false,
3150-
"title": "File share result",
3151-
"description": "The nullable public-share state for a file."
3152-
},
3153-
"V2GetFileShareResponse": {
3154-
"type": "object",
3155-
"properties": {
3156-
"data": {
3157-
"description": "Response data.",
3158-
"$ref": "#/components/schemas/V2GetFileShareResult"
3145+
"description": "Response data."
31593146
}
31603147
},
31613148
"required": ["data"],
@@ -3165,45 +3152,28 @@
31653152
"examples": [
31663153
{
31673154
"data": {
3168-
"share": {
3169-
"id": "shr_8Hf3kL9wQ2mNpXr6Tz1Vb",
3170-
"token": "share-token-example",
3171-
"url": "https://www.sim.ai/f/share-token-example",
3172-
"isActive": true,
3173-
"resourceType": "file",
3174-
"resourceId": "wf_V1StGXR8z5jdHi6BmyT91",
3175-
"authType": "public",
3176-
"hasPassword": false,
3177-
"allowedEmails": []
3178-
}
3155+
"id": "shr_8Hf3kL9wQ2mNpXr6Tz1Vb",
3156+
"token": "share-token-example",
3157+
"url": "https://www.sim.ai/f/share-token-example",
3158+
"isActive": true,
3159+
"resourceType": "file",
3160+
"resourceId": "wf_V1StGXR8z5jdHi6BmyT91",
3161+
"authType": "public",
3162+
"hasPassword": false,
3163+
"allowedEmails": []
31793164
}
31803165
},
31813166
{
3182-
"data": {
3183-
"share": null
3184-
}
3167+
"data": null
31853168
}
31863169
]
31873170
},
3188-
"V2UpsertFileShareResult": {
3189-
"type": "object",
3190-
"properties": {
3191-
"share": {
3192-
"description": "Updated public share.",
3193-
"$ref": "#/components/schemas/V2FileShare"
3194-
}
3195-
},
3196-
"required": ["share"],
3197-
"additionalProperties": false,
3198-
"title": "Updated file share",
3199-
"description": "The updated public-share state for a file."
3200-
},
32013171
"V2UpsertFileShareResponse": {
32023172
"type": "object",
32033173
"properties": {
32043174
"data": {
32053175
"description": "Response data.",
3206-
"$ref": "#/components/schemas/V2UpsertFileShareResult"
3176+
"$ref": "#/components/schemas/V2FileShare"
32073177
}
32083178
},
32093179
"required": ["data"],
@@ -3213,17 +3183,15 @@
32133183
"examples": [
32143184
{
32153185
"data": {
3216-
"share": {
3217-
"id": "shr_8Hf3kL9wQ2mNpXr6Tz1Vb",
3218-
"token": "share-token-example",
3219-
"url": "https://www.sim.ai/f/share-token-example",
3220-
"isActive": true,
3221-
"resourceType": "file",
3222-
"resourceId": "wf_V1StGXR8z5jdHi6BmyT91",
3223-
"authType": "public",
3224-
"hasPassword": false,
3225-
"allowedEmails": []
3226-
}
3186+
"id": "shr_8Hf3kL9wQ2mNpXr6Tz1Vb",
3187+
"token": "share-token-example",
3188+
"url": "https://www.sim.ai/f/share-token-example",
3189+
"isActive": true,
3190+
"resourceType": "file",
3191+
"resourceId": "wf_V1StGXR8z5jdHi6BmyT91",
3192+
"authType": "public",
3193+
"hasPassword": false,
3194+
"allowedEmails": []
32273195
}
32283196
}
32293197
]
@@ -3442,25 +3410,12 @@
34423410
"title": "File folder list response",
34433411
"description": "Workspace file folders in the current page."
34443412
},
3445-
"V2FileFolderData": {
3446-
"type": "object",
3447-
"properties": {
3448-
"folder": {
3449-
"description": "Created or relocated folder.",
3450-
"$ref": "#/components/schemas/V2Folder"
3451-
}
3452-
},
3453-
"required": ["folder"],
3454-
"additionalProperties": false,
3455-
"title": "File folder data",
3456-
"description": "A created or relocated file folder."
3457-
},
34583413
"FileFolderResponse": {
34593414
"type": "object",
34603415
"properties": {
34613416
"data": {
34623417
"description": "Response data.",
3463-
"$ref": "#/components/schemas/V2FileFolderData"
3418+
"$ref": "#/components/schemas/V2Folder"
34643419
}
34653420
},
34663421
"required": ["data"],

apps/docs/openapi-v2-knowledge.json

Lines changed: 4 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2107,24 +2107,12 @@
21072107
"title": "Knowledge base list response",
21082108
"description": "A cursor-paginated page of knowledge bases."
21092109
},
2110-
"V2KnowledgeBaseData": {
2111-
"type": "object",
2112-
"properties": {
2113-
"knowledgeBase": {
2114-
"$ref": "#/components/schemas/V2KnowledgeBase"
2115-
}
2116-
},
2117-
"required": ["knowledgeBase"],
2118-
"additionalProperties": false,
2119-
"title": "Knowledge base data",
2120-
"description": "A single knowledge base payload."
2121-
},
21222110
"V2KnowledgeBaseResponse": {
21232111
"type": "object",
21242112
"properties": {
21252113
"data": {
21262114
"description": "Response data.",
2127-
"$ref": "#/components/schemas/V2KnowledgeBaseData"
2115+
"$ref": "#/components/schemas/V2KnowledgeBase"
21282116
}
21292117
},
21302118
"required": ["data"],
@@ -2630,24 +2618,12 @@
26302618
"title": "Knowledge document list response",
26312619
"description": "A cursor-paginated page of knowledge documents."
26322620
},
2633-
"V2KnowledgeDocumentSummaryData": {
2634-
"type": "object",
2635-
"properties": {
2636-
"document": {
2637-
"$ref": "#/components/schemas/V2KnowledgeDocumentSummary"
2638-
}
2639-
},
2640-
"required": ["document"],
2641-
"additionalProperties": false,
2642-
"title": "Knowledge document summary data",
2643-
"description": "A knowledge document upload acknowledgement."
2644-
},
26452621
"V2KnowledgeDocumentSummaryResponse": {
26462622
"type": "object",
26472623
"properties": {
26482624
"data": {
26492625
"description": "Response data.",
2650-
"$ref": "#/components/schemas/V2KnowledgeDocumentSummaryData"
2626+
"$ref": "#/components/schemas/V2KnowledgeDocumentSummary"
26512627
}
26522628
},
26532629
"required": ["data"],
@@ -3216,24 +3192,12 @@
32163192
"title": "Knowledge document",
32173193
"description": "Full document detail including processing state and connector provenance."
32183194
},
3219-
"V2KnowledgeDocumentData": {
3220-
"type": "object",
3221-
"properties": {
3222-
"document": {
3223-
"$ref": "#/components/schemas/V2KnowledgeDocument"
3224-
}
3225-
},
3226-
"required": ["document"],
3227-
"additionalProperties": false,
3228-
"title": "Knowledge document data",
3229-
"description": "A single knowledge document payload."
3230-
},
32313195
"V2KnowledgeDocumentResponse": {
32323196
"type": "object",
32333197
"properties": {
32343198
"data": {
32353199
"description": "Response data.",
3236-
"$ref": "#/components/schemas/V2KnowledgeDocumentData"
3200+
"$ref": "#/components/schemas/V2KnowledgeDocument"
32373201
}
32383202
},
32393203
"required": ["data"],
@@ -3299,24 +3263,12 @@
32993263
"title": "Knowledge folder list response",
33003264
"description": "A cursor-paginated page of knowledge-base folders."
33013265
},
3302-
"V2KnowledgeFolderData": {
3303-
"type": "object",
3304-
"properties": {
3305-
"folder": {
3306-
"$ref": "#/components/schemas/V2Folder"
3307-
}
3308-
},
3309-
"required": ["folder"],
3310-
"additionalProperties": false,
3311-
"title": "Knowledge folder data",
3312-
"description": "A single knowledge-base folder payload."
3313-
},
33143266
"V2KnowledgeFolderResponse": {
33153267
"type": "object",
33163268
"properties": {
33173269
"data": {
33183270
"description": "Response data.",
3319-
"$ref": "#/components/schemas/V2KnowledgeFolderData"
3271+
"$ref": "#/components/schemas/V2Folder"
33203272
}
33213273
},
33223274
"required": ["data"],

0 commit comments

Comments
 (0)