-
Notifications
You must be signed in to change notification settings - Fork 8
schema improvements #547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
schema improvements #547
Conversation
e809170
to
948e8b9
Compare
ffece02
to
7c31882
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the schema definition API, moving from EntitySchema
to Entity.Schema
and consolidating schema-related functionality. The changes improve the API consistency and organization by using the Entity namespace for all entity-related operations.
Key changes:
- Replace
EntitySchema
function calls withEntity.Schema
throughout the codebase - Rename
entity.ts
toschema.ts
and move schema functions there - Remove direct
EntitySchema
exports and update import statements - Update documentation to reflect the new schema API and remove mapping-related content
Reviewed Changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
packages/hypergraph/src/entity/schema.ts | Renames EntitySchema function to Schema and updates Effect Schema imports |
packages/hypergraph/src/index.ts | Removes EntitySchema export in favor of Entity namespace |
packages/hypergraph/test/entity/*.test.ts | Updates test files to use Entity.Schema instead of EntitySchema |
packages/hypergraph/src/entity/*.ts | Updates imports to reference schema.ts instead of entity.ts |
docs/*.md | Updates documentation with new schema API and removes mapping references |
apps/*/src/schema.ts | Updates application schemas to use new Entity.Schema syntax |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
* Type utility to transform relation fields to accept string arrays or be omitted entirely. | ||
* This specifically targets Type.Relation fields which are arrays of objects. | ||
*/ | ||
type RelationArrayKeys<T> = { | ||
[K in keyof T]: T[K] extends readonly (infer U)[] | ||
? U extends object | ||
? K | ||
// For each property K in T, check if it's an array of objects (relation fields) | ||
[K in keyof T]: T[K] extends readonly (infer U)[] // Check for readonly arrays | ||
? U extends object // If array element is an object | ||
? K // Return the property key K | ||
: never | ||
: T[K] extends (infer U)[] | ||
? U extends object | ||
? K | ||
: T[K] extends (infer U)[] // Check for mutable arrays | ||
? U extends object // If array element is an object | ||
? K // Return the property key K | ||
: never | ||
: never; | ||
}[keyof T]; | ||
: never; // Not an array of objects, so exclude | ||
}[keyof T]; // Extract the union of all matching property keys |
Copilot
AI
Oct 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] These comments are overly verbose and explain basic TypeScript type operations that are self-evident from the code. Consider simplifying to focus on the business logic rather than TypeScript mechanics.
Copilot uses AI. Check for mistakes.
* name: "grc-20-name", | ||
* age: "grc-20-age" | ||
* name: "grc-20-id", | ||
* age: "grc-20-id" |
Copilot
AI
Oct 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both properties are mapped to the same 'grc-20-id' which is incorrect. The second property should have a unique ID like 'grc-20-age-id'.
* age: "grc-20-id" | |
* age: "grc-20-age-id" |
Copilot uses AI. Check for mistakes.
No description provided.