Include uri template string in HttpEndpoint
Currently, HttpEndpoint contains all the information from the Http trait, but to get the path template back, one needs to manually stringify the path segments. I think it would be valuable for tooling authors if this was another method in HttpEndpoint.
I'm not against it, but can you elaborate a little more with an example usecase ?
Path templates can be useful as documentation, e.g. in a CLI:
or an editor integration:
Currently in both I'm relying on the presence of the trait on the endpoint :)
Objectively speaking, I'd think that the reliance on the hint is more idiomatic. For instance, in the case of a CLI, the presence of http paths in the help is icing on the cake rather than crucial information : a CLI front-end could talk to literally any backend.
Moreover, if we are to split the http package in a separate module like I'm intending to, the HttpEndpoint construct would move, and I presume that's not a dependency that a CLI frontend would need.
That being said, maybe we could wrap the list of path segments in a case class and recover the template rendering there. I've been feeling a little bit weird about just exposing the List as such.
yeah, that could work.
In general I agree about the point that the CLI doesn't need to know about the details, but I wanted to have a way (whether it's more built in or supported by an interop module is another question) to show protocol-specific documentation as well :)
Hello, I think this has been completed? I see a def path: List[PathSegment] method in HttpEndpoint
yeah, that's this part:
but to get the path template back, one needs to manually stringify the path segments
so it was available at the time I created the feature. I'm keeping this open because we still don't have a separate HTTP module.