feat(core): support multiple wildcard segments in collection paths (#340) - #1638
Open
frammawiliansyah wants to merge 1 commit into
Open
frammawiliansyah wants to merge 1 commit into
frammawiliansyah wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 95c99ef The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This branch has not been deployed
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.
Description
Resolves #340.
/claim #340
Allows collection
pathto configure multiple wildcard segments (e.g.src/content/blog/*/*). Each*wildcard corresponds to exactly one non-empty segment of the entry slug (e.g.en/my-first-post), enabling multi-segment organization (such as locale-partitioned or date-partitioned collections) while preserving deterministic static schema loading over the GitHub API without dynamic function callbacks.Key Changes
packages/keystatic/src/app/path-utils.ts): AddedparseCollectionPathWildcardsto parse collection paths with single or multiple wildcard segments (*or**) and return the expected segment count. Throws a clear error for invalid wildcard placement.packages/keystatic/src/form/fields/text/validateText.tsx&errors.ts): Updated slug validation to enforce the exact number of non-empty slash-separated segments corresponding to the wildcard count in the collection path.packages/keystatic/src/reader/generic.ts): Updatedlistandreadmethods to filter entries by exact segment depth for multiple wildcard paths, preventing shallower or deeper matches..changeset/multi-wildcard-collection-path.md,path-utils.test.ts,multi-wildcard.test.ts): Added unit test suites verifying path wildcard parsing, validation error formatting, and reader multi-segment filtering.Impact & Architectural Notes
*and**collection configurations continue to behave identically.Verification
pnpm check:typespassed cleanly.vitest runpassed with 148 test files (1,287 tests passed).pnpm build:packagescompleted successfully.