-
Notifications
You must be signed in to change notification settings - Fork 539
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
Add scopedFactory #23987
base: main
Are you sure you want to change the base?
Add scopedFactory #23987
Conversation
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.
PR Overview
This PR adds a new method, SchemaFactory.scopedFactory, to simplify creating a new SchemaFactory with a nested scope string, enabling better organization and collision prevention for related schemas.
- Introduces the scopedFactory method in the SchemaFactory class for handling nested scopes.
- Updates tests to use the new scopedFactory method instead of manually concatenating scope strings.
- Updates API report files to document the new scopedFactory method.
Reviewed Changes
File | Description |
---|---|
.changeset/grumpy-crabs-hide.md | Specifies version bumps and changelog entry for the new feature. |
packages/dds/tree/src/simple-tree/api/schemaFactory.ts | Adds the scopedFactory method implementation with proper JSDoc comments. |
packages/dds/tree/src/test/simple-tree/api/schemaCreationUtilities.spec.ts | Updates tests to utilize the new scopedFactory method. |
Various API report files | Documents the new scopedFactory method across different API versions. |
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
🔗 Found some broken links! 💔 Run a link check locally to find them. See linkcheck output
|
This seems like a useful tool in certain scenarios. Have you considered an alternative API, where, rather than there being a method on const sfA = new SchemaFactory("A");
const sfB = new SchemaFactory({ parentScope: sfA, scope: "B" });
class C extends sfB.object("C", {}) {}
// C.identifier === "A.B.C" This is slightly less convenient to invoke, but it also keeps the feature (nested scoping) isolated to precisely where it matters (when defining new scopes) rather than having it be something that pops up in autocomplete every time you type Also, is there a reason this is being introduced on |
Description
Add
SchemaFactory.scopedFactory
Reviewer Guidance
The review process is outlined on this wiki page.