Skip to content

Commit af565a6

Browse files
feat: add project-scoped routing configuration to REST API
- Added enableProjectScoping flag to RestApiConfigSchema - Added projectResolution strategy (required/optional/auto) - Enables /api/v1/projects/:projectId/data/... routing pattern - Control plane routes remain unscoped - Backward compatible with 'auto' strategy Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
1 parent 330f3fa commit af565a6

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

packages/spec/src/api/rest-server.zod.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,27 @@ export const RestApiConfigSchema = z.object({
8080
enableBatch: z.boolean().default(true).describe('Enable batch operation endpoints'),
8181

8282
/**
83-
* Enable discovery endpoint
83+
* Enable API discovery endpoint
8484
*/
8585
enableDiscovery: z.boolean().default(true).describe('Enable API discovery endpoint'),
8686

87+
/**
88+
* Enable project-scoped routing (/api/v1/projects/:projectId/data/...)
89+
* When true, all data/meta/AI APIs are scoped under /projects/:projectId
90+
* Control plane routes (/auth, /cloud) remain unscoped
91+
*/
92+
enableProjectScoping: z.boolean().default(false)
93+
.describe('Enable project-scoped routing for data/meta/AI APIs'),
94+
95+
/**
96+
* Project ID resolution strategy when enableProjectScoping is true
97+
* - 'required': projectId must be in URL (strict, recommended for production)
98+
* - 'optional': projectId can be in URL or fallback to headers/session
99+
* - 'auto': backward compatible - accepts both scoped and unscoped routes
100+
*/
101+
projectResolution: z.enum(['required', 'optional', 'auto']).default('auto')
102+
.describe('Project ID resolution strategy'),
103+
87104
/**
88105
* API documentation configuration
89106
*/

0 commit comments

Comments
 (0)