Commit 51a3600
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
File tree
- apps
- docs
- sim
- app/api/v2
- custom-tools
- [id]
- files
- folders
- knowledge
- [id]
- documents
- [documentId]
- folders
- mcp-servers
- [id]
- secrets/[name]
- skills
- [id]
- tables
- [tableId]
- rows
- [rowId]
- views
- [viewId]
- folders
- workflows/folders
- lib/api/contracts/v2
- openapi
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3130 | 3130 | | |
3131 | 3131 | | |
3132 | 3132 | | |
3133 | | - | |
| 3133 | + | |
3134 | 3134 | | |
3135 | 3135 | | |
3136 | | - | |
| 3136 | + | |
3137 | 3137 | | |
3138 | 3138 | | |
3139 | 3139 | | |
| |||
3142 | 3142 | | |
3143 | 3143 | | |
3144 | 3144 | | |
3145 | | - | |
3146 | | - | |
3147 | | - | |
3148 | | - | |
3149 | | - | |
3150 | | - | |
3151 | | - | |
3152 | | - | |
3153 | | - | |
3154 | | - | |
3155 | | - | |
3156 | | - | |
3157 | | - | |
3158 | | - | |
| 3145 | + | |
3159 | 3146 | | |
3160 | 3147 | | |
3161 | 3148 | | |
| |||
3165 | 3152 | | |
3166 | 3153 | | |
3167 | 3154 | | |
3168 | | - | |
3169 | | - | |
3170 | | - | |
3171 | | - | |
3172 | | - | |
3173 | | - | |
3174 | | - | |
3175 | | - | |
3176 | | - | |
3177 | | - | |
3178 | | - | |
| 3155 | + | |
| 3156 | + | |
| 3157 | + | |
| 3158 | + | |
| 3159 | + | |
| 3160 | + | |
| 3161 | + | |
| 3162 | + | |
| 3163 | + | |
3179 | 3164 | | |
3180 | 3165 | | |
3181 | 3166 | | |
3182 | | - | |
3183 | | - | |
3184 | | - | |
| 3167 | + | |
3185 | 3168 | | |
3186 | 3169 | | |
3187 | 3170 | | |
3188 | | - | |
3189 | | - | |
3190 | | - | |
3191 | | - | |
3192 | | - | |
3193 | | - | |
3194 | | - | |
3195 | | - | |
3196 | | - | |
3197 | | - | |
3198 | | - | |
3199 | | - | |
3200 | | - | |
3201 | 3171 | | |
3202 | 3172 | | |
3203 | 3173 | | |
3204 | 3174 | | |
3205 | 3175 | | |
3206 | | - | |
| 3176 | + | |
3207 | 3177 | | |
3208 | 3178 | | |
3209 | 3179 | | |
| |||
3213 | 3183 | | |
3214 | 3184 | | |
3215 | 3185 | | |
3216 | | - | |
3217 | | - | |
3218 | | - | |
3219 | | - | |
3220 | | - | |
3221 | | - | |
3222 | | - | |
3223 | | - | |
3224 | | - | |
3225 | | - | |
3226 | | - | |
| 3186 | + | |
| 3187 | + | |
| 3188 | + | |
| 3189 | + | |
| 3190 | + | |
| 3191 | + | |
| 3192 | + | |
| 3193 | + | |
| 3194 | + | |
3227 | 3195 | | |
3228 | 3196 | | |
3229 | 3197 | | |
| |||
3442 | 3410 | | |
3443 | 3411 | | |
3444 | 3412 | | |
3445 | | - | |
3446 | | - | |
3447 | | - | |
3448 | | - | |
3449 | | - | |
3450 | | - | |
3451 | | - | |
3452 | | - | |
3453 | | - | |
3454 | | - | |
3455 | | - | |
3456 | | - | |
3457 | | - | |
3458 | 3413 | | |
3459 | 3414 | | |
3460 | 3415 | | |
3461 | 3416 | | |
3462 | 3417 | | |
3463 | | - | |
| 3418 | + | |
3464 | 3419 | | |
3465 | 3420 | | |
3466 | 3421 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2107 | 2107 | | |
2108 | 2108 | | |
2109 | 2109 | | |
2110 | | - | |
2111 | | - | |
2112 | | - | |
2113 | | - | |
2114 | | - | |
2115 | | - | |
2116 | | - | |
2117 | | - | |
2118 | | - | |
2119 | | - | |
2120 | | - | |
2121 | | - | |
2122 | 2110 | | |
2123 | 2111 | | |
2124 | 2112 | | |
2125 | 2113 | | |
2126 | 2114 | | |
2127 | | - | |
| 2115 | + | |
2128 | 2116 | | |
2129 | 2117 | | |
2130 | 2118 | | |
| |||
2630 | 2618 | | |
2631 | 2619 | | |
2632 | 2620 | | |
2633 | | - | |
2634 | | - | |
2635 | | - | |
2636 | | - | |
2637 | | - | |
2638 | | - | |
2639 | | - | |
2640 | | - | |
2641 | | - | |
2642 | | - | |
2643 | | - | |
2644 | | - | |
2645 | 2621 | | |
2646 | 2622 | | |
2647 | 2623 | | |
2648 | 2624 | | |
2649 | 2625 | | |
2650 | | - | |
| 2626 | + | |
2651 | 2627 | | |
2652 | 2628 | | |
2653 | 2629 | | |
| |||
3216 | 3192 | | |
3217 | 3193 | | |
3218 | 3194 | | |
3219 | | - | |
3220 | | - | |
3221 | | - | |
3222 | | - | |
3223 | | - | |
3224 | | - | |
3225 | | - | |
3226 | | - | |
3227 | | - | |
3228 | | - | |
3229 | | - | |
3230 | | - | |
3231 | 3195 | | |
3232 | 3196 | | |
3233 | 3197 | | |
3234 | 3198 | | |
3235 | 3199 | | |
3236 | | - | |
| 3200 | + | |
3237 | 3201 | | |
3238 | 3202 | | |
3239 | 3203 | | |
| |||
3299 | 3263 | | |
3300 | 3264 | | |
3301 | 3265 | | |
3302 | | - | |
3303 | | - | |
3304 | | - | |
3305 | | - | |
3306 | | - | |
3307 | | - | |
3308 | | - | |
3309 | | - | |
3310 | | - | |
3311 | | - | |
3312 | | - | |
3313 | | - | |
3314 | 3266 | | |
3315 | 3267 | | |
3316 | 3268 | | |
3317 | 3269 | | |
3318 | 3270 | | |
3319 | | - | |
| 3271 | + | |
3320 | 3272 | | |
3321 | 3273 | | |
3322 | 3274 | | |
| |||
0 commit comments