Repository navigation
fix(go-parser): join group prefixes and route paths the way Gin does - #18
Merged
Merged
Conversation
Route paths were the plain concatenation of every Group() prefix and the
route path, so groups written without slashes (Group("api").Group("v1")
.POST("device")) came out as "apiv1device" instead of /api/v1/device, and
"/api/" + "/users" as "/api//users". Gin joins them with path.Join, keeping a
trailing slash on the relative path; joinPaths does the same.
thingspanel-backend-community: 233 of 267 routes had a malformed path, now 0.
ginfast: 2 of 122, now 0. Route counts unchanged.
Merged
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.
Route paths were the plain concatenation of every
Group()prefix and the route path. Groups written without slashes —Group("api").Group("v1").POST("device")— came out asapiv1deviceinstead of/api/v1/device, and"/api/"+"/users"as/api//users. Merge after #12 for a green CI build.Fix
joinPathsinroute-parser.tsjoins the way Gin does (path.Join): always rooted, no doubled slashes, keeping a trailing slash the relative path has. A route on the engine with an empty path is/.Side effect: the auth skip-list matches
method + pathexactly, so routes that had a malformed path could not match it before; they now can.Verified
route-path-join.test.ts). go-parser 95/97 on Windows; the 2 failures are the existing scanner path-separator tests fixed by fix(build): build workspaces in dependency order so a clean checkout builds #12.