Uh oh!
There was an error while loading. Please reload this page.
feat: add well-known capabilities to API discovery - #779
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…rotocol schemas Add feed, comments, automation, cron, search, export, chunkedUpload boolean capability flags. Update GetDiscoveryResponseSchema, protocol implementation, and client SDK with capabilities getter. Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
… ROADMAP Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
Adds a typed, flat set of well-known capability flags to the API discovery contract so clients (notably ObjectUI) can adapt UI/behavior without endpoint probing, and wires the flags through server protocol + client SDK.
Changes:
- Introduced
WellKnownCapabilitiesSchema(7 boolean flags) and added it toGetDiscoveryResponseSchema.capabilities. - Implemented dynamic capability derivation in
ObjectStackProtocolImplementation.getDiscovery()based on registered services. - Exposed
ObjectStackClient.capabilitiesgetter and added/updated tests and roadmap entries.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/spec/src/api/protocol.zod.ts | Adds capabilities to GetDiscoveryResponseSchema and imports the new schema. |
| packages/spec/src/api/protocol.test.ts | Adds schema validation tests for GetDiscoveryResponseSchema.capabilities. |
| packages/spec/src/api/discovery.zod.ts | Introduces WellKnownCapabilitiesSchema + inferred TS type. |
| packages/spec/src/api/discovery.test.ts | Adds tests for WellKnownCapabilitiesSchema parsing and .describe() coverage. |
| packages/objectql/src/protocol.ts | Populates capabilities in runtime discovery response from the service registry. |
| packages/objectql/src/protocol-discovery.test.ts | Adds tests verifying capability flags track service registration. |
| packages/client/src/index.ts | Adds capabilities getter to expose server-discovered flags post-connect(). |
| packages/client/src/client.test.ts | Adds tests for the new client getter behavior. |
| ROADMAP.md | Marks discovery capabilities + client getter work as completed. |
| apiName: z.string().describe('API name'), | ||
| routes: ApiRoutesSchema.optional().describe('Available endpoint paths'), | ||
| services: z.record(z.string(), ServiceInfoSchema).optional().describe('Per-service availability map'), | ||
| capabilities: WellKnownCapabilitiesSchema.optional().describe('Well-known capability flags for frontend adaptation'), |
There was a problem hiding this comment.
The JSDoc for GetDiscoveryResponseSchema still says “capabilities was removed — derive from services[x].enabled”, but this schema now includes a capabilities field again. Please update/remove that note so the documentation matches the current contract (and clarifies how these well-known flags relate to services).
| import { GetDiscoveryResponseSchema } from './protocol.zod'; | ||
There was a problem hiding this comment.
This file already imports many schemas from ./protocol.zod at the top; adding a second import later in the file makes the import section harder to maintain and can trip import-order linting. Consider moving GetDiscoveryResponseSchema into the existing top import list instead of importing it at the bottom.
| // ========================================== | ||
There was a problem hiding this comment.
These new tests validate the top-level ObjectStackClient.capabilities getter, but they’re nested under describe('ObjectStackClient.automation', ...), which makes the suite misleading and harder to find. Consider moving them into a dedicated describe('ObjectStackClient.capabilities', ...) block.
| // ========================================== | |
| // ========================================== | |
| }); | |
| describe('ObjectStackClient.capabilities',()=>{ |
Adds typed boolean capability flags to the Discovery response so ObjectUI can detect backend features without probing individual endpoints.
Schema (
packages/spec)WellKnownCapabilitiesSchemaindiscovery.zod.tswith 7 fields:feed,comments,automation,cron,search,export,chunkedUploadcapabilitiestoGetDiscoveryResponseSchemainprotocol.zod.tsRuntime (
packages/objectql)getDiscovery()now builds capabilities dynamically from the service registry:Client SDK (
packages/client)get capabilities(): WellKnownCapabilities | undefinedgetter, available afterconnect()Tests
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.