Enforce absolute or root paths for extension src props#4882
Merged
Conversation
Co-authored-by: adrians5j <[email protected]>
Co-authored-by: adrians5j <[email protected]>
Co-authored-by: adrians5j <[email protected]>
Co-authored-by: adrians5j <[email protected]>
Copilot stopped work on behalf of
adrians5j due to an error
January 16, 2026 21:27
adrians5j
requested changes
Jan 17, 2026
| @@ -3,3 +3,4 @@ export * from "./defineApiExtension.js"; | |||
| export * from "./models/index.js"; | |||
| export * from "./zodTypes/zodPathToAbstraction.js"; | |||
| export * from "./zodTypes/zodPathToFile.js"; | |||
Member
There was a problem hiding this comment.
I see you've added new zodAbsoluteOrRootPath.
My idea was to basically adjust existing zodPathToFile. We don't need two of these.
Finally, let's do another refactor.
Instead of having zodPathToAbstraction and zodPathToFile, let's just have single src type, which optionally takes abstraction param. If provided, then we do the exported abstraction validation.
Contributor
Author
There was a problem hiding this comment.
Done! I've refactored the code to use a single zodSrcPath function that takes an optional abstraction parameter. The function now:
- Replaces all three validators (
zodPathToFile,zodPathToAbstraction,zodAbsoluteOrRootPath) - Handles both cases: with and without abstraction validation
- Enforces absolute or root-relative paths in all cases
Updated in commit 8a4574c.
Co-authored-by: adrians5j <[email protected]>
Co-authored-by: adrians5j <[email protected]>
Copilot
AI
changed the title
[WIP] Update src prop paths to enforce absolute or root paths
Enforce absolute or root paths for extension src props
Jan 17, 2026
…ute-or-root-paths
…ute-or-root-paths
Member
|
/e2e |
|
Cypress E2E tests have been initiated (for more information, click here). ✨ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implementation Plan
defineApiExtension.tsto use the new validatorAdminExtension.tsto use the new validatorProjectDecorator.tsto use the new validatorProjectImplementation.tsto use the new validatorextensions/graphql/MySchemaExtension.tsxto use the correct path formatextensions/_wip/idp/MyIdpExtension.tsxto use the correct path formatChanges Made
Created unified
zodSrcPath.tsvalidator that:zodPathToFile,zodPathToAbstraction, andzodAbsoluteOrRootPathabstractionparameter - when provided, validates the exported implementationpath.isAbsolute())/(from project root)./file.ts,../folder/file.tsfolder/file.ts/before joining with rootFolderUpdated all extension definitions to use the new unified validator (34 files total):
defineApiExtension.ts- simplified to single zodSrcPath callAdminExtension.ts- uses zodSrcPathProjectDecorator.ts- uses zodSrcPathProjectImplementation.ts- uses zodSrcPathRemoved old validator files:
zodPathToFile.tszodPathToAbstraction.tszodAbsoluteOrRootPath.tsUpdated example files to use paths from project root:
extensions/graphql/MySchemaExtension.tsx- changed to/extensions/graphql/MyGraphQLSchema.tsextensions/_wip/idp/MyIdpExtension.tsx- changed to/extensions/_wip/idp/MyIdp.tsThis refactoring provides a cleaner, more maintainable API with all path validation logic consolidated in a single function.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.