hylo-lang / hylodoc

Code documentation generator for Hylo
https://hylodoc.web.app
Apache License 2.0
1 stars 0 forks source link

Using RelativePath and AbsolutePath instead of Swift's URL types #7

Open tothambrus11 opened 4 months ago

tothambrus11 commented 4 months ago

Swift URLs can refer to relative paths, absolute paths, might or might not contain / at the end of the path, so in general the type does not have much guarantees when working with. This makes working with them in the website generation quite error-prone and it's hard to reason about the type of URL received as an argument without keeping the whole website generation code base in our head.

We should use some ideas from https://github.com/sersoft-gmbh/path-wrangler, along with new nominal types for different purposes, e.g. absolute path on disk vs absolute path for a web url.

This could save us from many calls from url.standardized that we sometimes use throughout the code base to be sure that we don't have weird things going on in the URL, and we can compare them part-wise to e.g. determine when one url subsumes another one.