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>
91314b1
into
copilot/update-examples-and-test-platform
There was a problem hiding this comment.
Pull request overview
This PR adds missing type exports and configuration schemas to fix TypeScript compilation errors in the examples/basic package. The changes introduce new configuration schemas for API modules (OData, Realtime, Batch) and add backwards-compatible type aliases across multiple modules (Hub, System, Integration).
Changes:
- Added package.json exports for integration and permission modules
- Added type aliases for backwards compatibility (JobSchedule, SaaSConnector, Space, MarketplaceListing, ComposerConfig)
- Added new configuration schemas (ODataConfig, RealtimeConfig, BatchConfig) with corresponding JSON schemas and documentation
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/spec/package.json | Added exports for integration and permission modules |
| packages/spec/src/system/job.zod.ts | Added JobSchedule type alias for backwards compatibility |
| packages/spec/src/integration/connector/saas.zod.ts | Added SaaSConnector type alias for alternative capitalization |
| packages/spec/src/hub/space.zod.ts | Added Space type alias for backwards compatibility |
| packages/spec/src/hub/marketplace.zod.ts | Added MarketplaceListing type alias for backwards compatibility |
| packages/spec/src/hub/composer.zod.ts | Added ComposerConfig type alias for configuration context |
| packages/spec/src/api/realtime.zod.ts | Added RealtimeConfigSchema for realtime API configuration |
| packages/spec/src/api/odata.zod.ts | Added ODataConfigSchema for OData API configuration |
| packages/spec/src/api/batch.zod.ts | Added BatchConfigSchema for batch operations configuration |
| packages/spec/json-schema/api/RealtimeConfig.json | Generated JSON schema for RealtimeConfig |
| packages/spec/json-schema/api/ODataConfig.json | Generated JSON schema for ODataConfig |
| packages/spec/json-schema/api/BatchConfig.json | Generated JSON schema for BatchConfig |
| content/docs/references/api/realtime.mdx | Updated documentation with RealtimeConfig schema |
| content/docs/references/api/odata.mdx | Updated documentation with ODataConfig schema |
| content/docs/references/api/batch.mdx | Updated documentation with BatchConfig schema |
|
|
||
| /** Default subscriptions */ | ||
| subscriptions: z.array(SubscriptionSchema).optional().describe('Default subscriptions'), | ||
| }).passthrough(); // Allow additional properties |
There was a problem hiding this comment.
The use of .passthrough() here is inconsistent with the rest of the codebase. No other schemas in the spec package use .passthrough() or .strict(), relying instead on Zod's default .strip() behavior.
Using .passthrough() on configuration schemas can lead to:
- Silent acceptance of typos in configuration keys
- Difficulty in catching configuration errors at validation time
- Inconsistency with established patterns in the codebase
Consider removing .passthrough() to align with the codebase conventions. If additional properties are genuinely needed for extensibility, this should be documented and applied consistently across all configuration schemas, or handled through a more explicit mechanism like an extensions or metadata field.
| export const ODataConfigSchema = z.object({ | ||
| /** Enable OData endpoint */ | ||
| enabled: z.boolean().default(true).describe('Enable OData API'), | ||
|
|
||
| /** OData endpoint path */ | ||
| path: z.string().default('/odata').describe('OData endpoint path'), | ||
|
|
||
| /** Metadata configuration */ | ||
| metadata: ODataMetadataSchema.optional().describe('OData metadata configuration'), | ||
| }).passthrough(); // Allow additional properties for flexibility | ||
|
|
||
| export type ODataConfig = z.infer<typeof ODataConfigSchema>; |
There was a problem hiding this comment.
The new ODataConfigSchema lacks test coverage. The odata.test.ts file has comprehensive tests for other schemas in odata.zod.ts, but no tests have been added for the new ODataConfigSchema.
Consider adding tests to verify:
- Default values (enabled=true, path='/odata')
- Optional metadata field
- Integration with ODataMetadataSchema
| export const RealtimeConfigSchema = z.object({ | ||
| /** Enable realtime sync */ | ||
| enabled: z.boolean().default(true).describe('Enable realtime synchronization'), | ||
|
|
||
| /** Transport protocol */ | ||
| transport: TransportProtocol.default('websocket').describe('Transport protocol'), | ||
|
|
||
| /** Default subscriptions */ | ||
| subscriptions: z.array(SubscriptionSchema).optional().describe('Default subscriptions'), | ||
| }).passthrough(); // Allow additional properties | ||
|
|
||
| export type RealtimeConfig = z.infer<typeof RealtimeConfigSchema>; |
There was a problem hiding this comment.
The new RealtimeConfigSchema lacks test coverage. The realtime.test.ts file has comprehensive tests for other schemas in realtime.zod.ts, but no tests have been added for the new RealtimeConfigSchema.
Consider adding tests to verify:
- Default values (enabled=true, transport='websocket')
- Optional subscriptions field
- Integration with SubscriptionSchema and TransportProtocol
|
|
||
| /** Metadata configuration */ | ||
| metadata: ODataMetadataSchema.optional().describe('OData metadata configuration'), | ||
| }).passthrough(); // Allow additional properties for flexibility |
There was a problem hiding this comment.
The use of .passthrough() here is inconsistent with the rest of the codebase. No other schemas in the spec package use .passthrough() or .strict(), relying instead on Zod's default .strip() behavior.
Using .passthrough() on configuration schemas can lead to:
- Silent acceptance of typos in configuration keys
- Difficulty in catching configuration errors at validation time
- Inconsistency with established patterns in the codebase
Consider removing .passthrough() to align with the codebase conventions. If additional properties are genuinely needed for extensibility, this should be documented and applied consistently across all configuration schemas, or handled through a more explicit mechanism like an extensions or metadata field.
|
|
||
| /** Default options */ | ||
| defaultOptions: BatchOptionsSchema.optional().describe('Default batch options'), | ||
| }).passthrough(); // Allow additional properties |
There was a problem hiding this comment.
The use of .passthrough() here is inconsistent with the rest of the codebase. No other schemas in the spec package use .passthrough() or .strict(), relying instead on Zod's default .strip() behavior.
Using .passthrough() on configuration schemas can lead to:
- Silent acceptance of typos in configuration keys
- Difficulty in catching configuration errors at validation time
- Inconsistency with established patterns in the codebase
Consider removing .passthrough() to align with the codebase conventions. If additional properties are genuinely needed for extensibility, this should be documented and applied consistently across all configuration schemas, or handled through a more explicit mechanism like an extensions or metadata field.
| export type CronSchedule = z.infer<typeof CronScheduleSchema>; | ||
| export type IntervalSchedule = z.infer<typeof IntervalScheduleSchema>; | ||
| export type OnceSchedule = z.infer<typeof OnceScheduleSchema>; | ||
| export type JobSchedule = Schedule; // Alias for backwards compatibility |
There was a problem hiding this comment.
There's a discrepancy between the PR title "[WIP] Fix issue in job step execution" and the actual changes, which are focused on adding missing type exports and configuration schemas to fix TypeScript compilation errors in examples/basic. The PR title should be updated to accurately reflect the changes being made, such as "Add missing type exports and config schemas to fix compilation errors".
|
|
||
| // Validate data | ||
| const result = ODataErrorSchema.parse(data); | ||
| const result = ODataConfigSchema.parse(data); |
There was a problem hiding this comment.
The example code has been changed from parsing ODataErrorSchema to ODataConfigSchema. This change doesn't make sense in the context of the documentation - the example should demonstrate the primary use case of the API module. If ODataConfigSchema is more important, this is a reasonable change, but if ODataErrorSchema was the better example before, changing it just because a new schema was added is inconsistent.
Consider whether this change is intentional or if it should revert to the original example while still documenting the new ODataConfigSchema elsewhere in the file.
| const result = ODataConfigSchema.parse(data); | |
| const result = ODataErrorSchema.parse(data); |
|
|
||
| // Validate data | ||
| const result = BatchOperationResultSchema.parse(data); | ||
| const result = BatchConfigSchema.parse(data); |
There was a problem hiding this comment.
The example code has been changed from parsing BatchOperationResultSchema to BatchConfigSchema. This change doesn't make sense in the context of the documentation - the example should demonstrate the primary use case of the API module. If BatchConfigSchema is more important, this is a reasonable change, but if BatchOperationResultSchema was the better example before, changing it just because a new schema was added is inconsistent.
Consider whether this change is intentional or if it should revert to the original example while still documenting the new BatchConfigSchema elsewhere in the file.
| const result = BatchConfigSchema.parse(data); | |
| const result = BatchOperationResultSchema.parse(data); |
| export const BatchConfigSchema = z.object({ | ||
| /** Enable batch operations */ | ||
| enabled: z.boolean().default(true).describe('Enable batch operations'), | ||
|
|
||
| /** Maximum records per batch */ | ||
| maxRecordsPerBatch: z.number().int().min(1).max(1000).default(200).describe('Maximum records per batch'), | ||
|
|
||
| /** Default options */ | ||
| defaultOptions: BatchOptionsSchema.optional().describe('Default batch options'), | ||
| }).passthrough(); // Allow additional properties | ||
|
|
||
| export type BatchConfig = z.infer<typeof BatchConfigSchema>; |
There was a problem hiding this comment.
The new BatchConfigSchema lacks test coverage. The batch.test.ts file has comprehensive tests for all other schemas in batch.zod.ts, but no tests have been added for the new BatchConfigSchema.
Consider adding tests to verify:
- Default values (enabled=true, maxRecordsPerBatch=200)
- Min/max constraints on maxRecordsPerBatch
- Optional defaultOptions field
- Integration with BatchOptionsSchema
Fix TypeScript Compilation Errors in examples/basic
ODataConfig,RealtimeConfig,BatchConfigto API moduleMarketplaceListing,Space,ComposerConfigaliases to Hub moduleJobSchedulealias to System moduleSaaSConnectoralias to Integration moduleintegrationandpermissionexports to package.jsonOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.