You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If so, then I will put up a PR which accomplishes this.
The text was updated successfully, but these errors were encountered:
ehyche
changed the title
Bug where route path component parameter and constant
Bug where route path component contains both parameter and constant
Feb 11, 2025
So yes this is probably a bug, the issue is that Vapor's router doesn't currently support partially constant path parameters. So I suspect what you'll need to do is use the same handler and check in the handler if the path ends on .zip.
As an aside, having a fully dynamic path and a partially dynamic path is going to be ambiguous at best. We want to be able to support partially dynamic parameters in Vapor 5 but will need to consider the precedence of different path components because from a high level GET /{scope}/{name}/{version} would match just fine with /pointfreeco/swift-clocks/1.0.6.zip since there's no spec for 'Version'. So we will need to be careful not to tank performance in the router with whatever solution we come up with
I am implementing a Swift Package Registry Service using
swift-openapi-vapor
. This service contains (among others) these two endpoints:GET /{scope}/{name}/{version}
GET /{scope}/{name}/{version}.zip
The OpenAPI spec for this service can be found here.
The bug is: the
VaporTransport
cannot distinguish between these two routes. When I hit the my server with the following URL:then this gets parsed as a
fetchReleaseMetadata
route rather than adownloadSourceArchive
route.I believe the bug is here in
VaporTransport.swift
:Currently the OpenAPI path
/{scope}/{name}/{version}.zip
is getting parsed as:I would assume that the OpenAPI path
/{scope}/{name}/{version}.zip
should get parsed as:Is this a correct assumption?
If so, then I will put up a PR which accomplishes this.
The text was updated successfully, but these errors were encountered: