Now that https://github.com/giraffe-fsharp/Giraffe/issues/282 has been implemented and will probably make it into Giraffe's next release, Saturn probably needs to handle those as well. There are two aspects that need to be considered:
The new %u format parameter will convert to a uint64 value, but in the URL it is represented as a "short ID" a.k.a. a Youtube video ID: a base64url representation of the uint64 value, with the final = character trimmed because the length is known. This will need to be handled in the controller code, but the stringConvert part of that code will need to use something like Giraffe's ShortId.fromUInt64 function.
The %O format parameter can now accept conventional GUIDs or "Short GUIDs": a base64url representation of the GUID, 22 characters long. Depending on how the GUID is encoded in the URL, this could cause the call to Giraffe's subRoute function to fail: a 22-char ShortGUID will (in the current code) be turned into the "standard" GUID representation by string<Guid>, which in turn means that the routeStartsWithPath call in subRoute will fail (because the route starts with the 22-char shortGuid, but subRoute will be handed a path that looks like /12345678-1234-1234-1234-abcdefabcdef). The simplest fix I can see for this one is to add a use_short_guids operation to the ControllerBuilder; if use_short_guids has been specified in this controller, then the stringConvert function for %O will use something like Giraffe's ShortGuid.fromGuid function instead of string<Guid>.
I'm excited about the possibility of the shortGuid and/or shortId formats being available for use in URLs, and with these two tweaks to Saturn, I think it will be possible to use Giraffe's soon-to-be-released new feature.
Update: Giraffe 3.0 has just been released, and the ShortGUID and ShortID (%O and %u) code is in that release. So this is now a necessity before Saturn moves to use Giraffe 3.0.
Now that https://github.com/giraffe-fsharp/Giraffe/issues/282 has been implemented and will probably make it into Giraffe's next release, Saturn probably needs to handle those as well. There are two aspects that need to be considered:
%u
format parameter will convert to auint64
value, but in the URL it is represented as a "short ID" a.k.a. a Youtube video ID: a base64url representation of the uint64 value, with the final=
character trimmed because the length is known. This will need to be handled in the controller code, but thestringConvert
part of that code will need to use something like Giraffe'sShortId.fromUInt64
function.%O
format parameter can now accept conventional GUIDs or "Short GUIDs": a base64url representation of the GUID, 22 characters long. Depending on how the GUID is encoded in the URL, this could cause the call to Giraffe'ssubRoute
function to fail: a 22-char ShortGUID will (in the current code) be turned into the "standard" GUID representation bystring<Guid>
, which in turn means that therouteStartsWithPath
call insubRoute
will fail (because the route starts with the 22-char shortGuid, but subRoute will be handed a path that looks like/12345678-1234-1234-1234-abcdefabcdef
). The simplest fix I can see for this one is to add ause_short_guids
operation to the ControllerBuilder; ifuse_short_guids
has been specified in this controller, then thestringConvert
function for%O
will use something like Giraffe'sShortGuid.fromGuid
function instead ofstring<Guid>
.I'm excited about the possibility of the shortGuid and/or shortId formats being available for use in URLs, and with these two tweaks to Saturn, I think it will be possible to use Giraffe's soon-to-be-released new feature.