Skip to content

Commit edff347

Browse files
improvement(api): default folder deletion to non-recursive
1 parent 4b06c45 commit edff347

6 files changed

Lines changed: 24 additions & 13 deletions

File tree

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,7 +1810,7 @@
18101810
"delete": {
18111811
"operationId": "deleteFilesFolder",
18121812
"summary": "Delete Folder",
1813-
"description": "Delete a folder. With `recursive=false`, the folder must be empty. With `recursive=true`, its descendant folders and resources are deleted too.",
1813+
"description": "Delete a folder. By default the folder must be empty. With `recursive=true`, its descendant folders and resources are deleted too.",
18141814
"tags": ["Files"],
18151815
"parameters": [
18161816
{
@@ -1828,10 +1828,11 @@
18281828
{
18291829
"name": "recursive",
18301830
"in": "query",
1831-
"required": true,
1831+
"required": false,
18321832
"description": "Whether to delete the subtree.",
18331833
"schema": {
1834-
"type": "boolean"
1834+
"type": "boolean",
1835+
"default": false
18351836
}
18361837
}
18371838
],

apps/docs/openapi-v2-knowledge.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,7 +1472,7 @@
14721472
"delete": {
14731473
"operationId": "deleteKnowledgeFolder",
14741474
"summary": "Delete Folder",
1475-
"description": "Delete a folder. With `recursive=false`, the folder must be empty. With `recursive=true`, its descendant folders and resources are deleted too.",
1475+
"description": "Delete a folder. By default the folder must be empty. With `recursive=true`, its descendant folders and resources are deleted too.",
14761476
"tags": ["Knowledge Bases"],
14771477
"parameters": [
14781478
{
@@ -1490,10 +1490,11 @@
14901490
{
14911491
"name": "recursive",
14921492
"in": "query",
1493-
"required": true,
1493+
"required": false,
14941494
"description": "Whether to delete the subtree.",
14951495
"schema": {
1496-
"type": "boolean"
1496+
"type": "boolean",
1497+
"default": false
14971498
}
14981499
}
14991500
],

apps/docs/openapi-v2-tables.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4075,7 +4075,7 @@
40754075
"delete": {
40764076
"operationId": "deleteTablesFolder",
40774077
"summary": "Delete Folder",
4078-
"description": "Delete a folder. With `recursive=false`, the folder must be empty. With `recursive=true`, its descendant folders and resources are deleted too.",
4078+
"description": "Delete a folder. By default the folder must be empty. With `recursive=true`, its descendant folders and resources are deleted too.",
40794079
"tags": ["Tables"],
40804080
"parameters": [
40814081
{
@@ -4093,10 +4093,11 @@
40934093
{
40944094
"name": "recursive",
40954095
"in": "query",
4096-
"required": true,
4096+
"required": false,
40974097
"description": "Whether to delete the subtree.",
40984098
"schema": {
4099-
"type": "boolean"
4099+
"type": "boolean",
4100+
"default": false
41004101
}
41014102
}
41024103
],

apps/docs/openapi-v2-workflows.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,7 +1948,7 @@
19481948
"delete": {
19491949
"operationId": "deleteWorkflowsFolder",
19501950
"summary": "Delete Folder",
1951-
"description": "Delete a folder. With `recursive=false`, the folder must be empty. With `recursive=true`, its descendant folders and resources are deleted too.",
1951+
"description": "Delete a folder. By default the folder must be empty. With `recursive=true`, its descendant folders and resources are deleted too.",
19521952
"tags": ["Workflows"],
19531953
"parameters": [
19541954
{
@@ -1966,10 +1966,11 @@
19661966
{
19671967
"name": "recursive",
19681968
"in": "query",
1969-
"required": true,
1969+
"required": false,
19701970
"description": "Whether to delete the subtree.",
19711971
"schema": {
1972-
"type": "boolean"
1972+
"type": "boolean",
1973+
"default": false
19731974
}
19741975
}
19751976
],

apps/sim/lib/api/contracts/v2/__tests__/shared.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { describe, expect, it } from 'vitest'
22
import { v2ListLogsQuerySchema } from '@/lib/api/contracts/v2/logs'
33
import {
4+
v2DeleteFolderQuerySchema,
45
v2FolderPathInputSchema,
56
v2FolderPathSchema,
67
v2NonRootFolderPathInputSchema,
@@ -43,6 +44,12 @@ describe('v2 folder path contracts', () => {
4344
).toBe(false)
4445
})
4546

47+
it('defaults folder deletion to non-recursive', () => {
48+
expect(v2DeleteFolderQuerySchema.parse({ workspaceId: WORKSPACE_ID, path: 'Reports' })).toEqual(
49+
{ workspaceId: WORKSPACE_ID, path: '/Reports', recursive: false }
50+
)
51+
})
52+
4653
it('normalizes every folder path in the logs filter', () => {
4754
const query = v2ListLogsQuerySchema.parse({
4855
workspaceId: WORKSPACE_ID,

apps/sim/lib/api/contracts/v2/shared.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ export const v2DeleteFolderQuerySchema = z
179179
.object({
180180
workspaceId: workspaceIdSchema,
181181
path: v2NonRootFolderPathInputSchema,
182-
recursive: z.stringbool(),
182+
recursive: z.stringbool().optional().default(false),
183183
})
184184
.strict()
185185

0 commit comments

Comments
 (0)