Add a warning if an optional segment isn't necessary due to a static route#772
Merged
bitspittle merged 4 commits intodevfrom Feb 12, 2026
Merged
Conversation
... where we will use it for readability as part of verifying dynamic routes.
5f6b7f5 to
662da7d
Compare
DennisTsar
reviewed
Feb 11, 2026
tools/processor-common/src/main/kotlin/com/varabyte/kobweb/project/frontend/FrontendData.kt
Outdated
Show resolved
Hide resolved
89696bb to
c3fa5e5
Compare
DennisTsar
approved these changes
Feb 11, 2026
| }.forEach { entry -> | ||
| val parentDir = entry.route.substringBeforeLast('/').anonymizeDynamicSegments() + "/" | ||
| val finalSegment = entry.route.substringAfterLast('/') | ||
| val matchingStateEntry = entriesByRoute[parentDir]?.first() |
Collaborator
There was a problem hiding this comment.
matchingStateEntry is a strange name, matchingRouteEntry maybe?
Member
Author
There was a problem hiding this comment.
Whoops! It was supposed to be "matchingPageEntry" -- using "state" was just a brain fart. Thanks!
e.g. "/a/b/c/{d?}" when "/a/b/c/" is also registered.
At that point, we will issue an error telling
that the user drop the question mark, as in:
"/a/b/c/{d?}" -> "/a/b/c/{d}"
NOTE: A warning might have been more suitable for this case,
but this would cause the warning to get printed twice, once
when KSP processed the project and a second time when the Gradle
plugin merged the results from all sources. An error may be a
bit harsh, but there really is no reason I can see to define
an unecessary optional route.
fddc6d0 to
14cdfa9
Compare
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.
No description provided.