Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
…ppingSchema Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
14d984b
into
copilot/add-http-server-implementation
There was a problem hiding this comment.
Pull request overview
Fixes CI failures stemming from missing/ambiguous exports by making HttpMethod available to API consumers and removing a naming collision in the external lookup tests.
Changes:
- Re-export
HttpMethodfrompackages/spec/src/api/router.zod.tsso it’s available via@objectstack/spec/api. - Update
external-lookup.test.tsto useExternalFieldMappingSchema/ExternalFieldMappinginstead of the ambiguousFieldMappingSchema/FieldMapping. - Add generated JSON Schema output for
HttpMethodand introduce a new docs page underreferences/api.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/spec/src/data/external-lookup.test.ts | Avoids FieldMappingSchema naming ambiguity by using the external-lookup-specific schema/type. |
| packages/spec/src/api/router.zod.ts | Re-exports HttpMethod for downstream imports from @objectstack/spec/api. |
| packages/spec/json-schema/api/HttpMethod.json | Adds the JSON Schema artifact for HttpMethod. |
| content/docs/references/api/view.mdx | Adds documentation for HttpMethod under the API docs section (but currently has inconsistencies). |
| import { CorsConfigSchema, StaticMountSchema, HttpMethod } from '../shared/http.zod'; | ||
|
|
||
| // Re-export HttpMethod for convenience | ||
| export { HttpMethod }; |
There was a problem hiding this comment.
export { HttpMethod } only re-exports the runtime Zod schema value. If the intent is to let downstream consumers also import type HttpMethod from @objectstack/spec/api, you also need a type-only re-export (otherwise only @objectstack/spec/shared exposes the type).
| export { HttpMethod }; | |
| export { HttpMethod }; | |
| export type { HttpMethod } from '../shared/http.zod'; |
| # View | ||
|
|
||
| <Callout type="info"> | ||
| **Source:** `packages/spec/src/api/view.zod.ts` |
There was a problem hiding this comment.
The referenced source file packages/spec/src/api/view.zod.ts does not exist in this repo (the HttpMethod schema is defined in packages/spec/src/shared/http.zod.ts). This makes the doc misleading and hard to trace.
| **Source:** `packages/spec/src/api/view.zod.ts` | |
| **Source:** `packages/spec/src/shared/http.zod.ts` |
| import { HttpMethodSchema } from '@objectstack/spec/api'; | ||
| import type { HttpMethod } from '@objectstack/spec/api'; | ||
|
|
||
| // Validate data | ||
| const result = HttpMethodSchema.parse(data); |
There was a problem hiding this comment.
The TypeScript snippet imports HttpMethodSchema from @objectstack/spec/api, but the API package exports HttpMethod (from shared/http.zod.ts via api/router.zod.ts), not HttpMethodSchema. As written, this example will not compile / will confuse consumers.
| import { HttpMethodSchema } from '@objectstack/spec/api'; | |
| import type { HttpMethod } from '@objectstack/spec/api'; | |
| // Validate data | |
| const result = HttpMethodSchema.parse(data); | |
| import { HttpMethod } from '@objectstack/spec/api'; | |
| // Validate data | |
| const result = HttpMethod.parse(data); |
| title: View | ||
| description: View protocol schemas | ||
| --- | ||
|
|
||
| # View |
There was a problem hiding this comment.
This doc page is named and titled "View", but its content documents HttpMethod only. Consider renaming the page (and frontmatter/title) to match the schema being documented, or expanding the content to actually cover the API "View" protocol.
| title: View | |
| description: View protocol schemas | |
| --- | |
| # View | |
| title: HttpMethod | |
| description: HTTP method schema | |
| --- | |
| # HttpMethod |
CI tests failed because
HttpMethodandFieldMappingSchemawere imported but not re-exported from modules where tests expected them.Changes
router.zod.ts: Re-exportHttpMethodfromshared/http.zod.tsexternal-lookup.test.ts: UseExternalFieldMappingSchemadirectly instead of aliasedFieldMappingSchemato avoid naming conflict with base schema fromshared/mapping.zod.tsThe issue surfaced when both
shared/mapping.zod.tsanddata/external-lookup.zod.tsexported aFieldMappingSchemathroughdata/index.ts, causing ambiguous module resolution.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.