Open mhamann opened 4 years ago
In https://github.com/delvedor/find-my-way/pull/27, this feature was actually coded with - as a separator, so it's working as expected.
We can potentially change this in a semver-major (one is due soon), but it 's not clear how if we want to retain similar functionality (having a part of a segment being parametric).
Thanks for the background @mcollina. So, what's the expected behavior of /foo/:param-x
vs. /foo/:param-x-:param-y
?
I looked at https://github.com/delvedor/find-my-way/blob/master/test/issue-17.test.js and realized that my first example would make -x
the suffix of the parameter. So now I better understand the comment you made.
What do you think about wrapping a param to indicate that it should be taken literally? e.g. /foo/:{param-x}
?
That would work.
Hello, What's the next step??
Somebody that needs this feature should work on it ;)
I've got a situation where I'm taking an OpenAPI v3 doc, parsing it, and registering its paths in find-my-way via fastify.
However, I'm facing a problem where the OpenAPI doc has path parameters in the format
{some-param}
. I convert those to:some-param
for find-my-way, but they're then interpreted as a parametersome
+ a path segmentparam
. This is caused by this parsing logic: https://github.com/delvedor/find-my-way/blob/master/index.js#L131I'll submit a PR, but I think that logic should ensure that the
-
character is followed by a:
to indicate the second parameter. Otherwise, it should be assumed that it's just a continuation of the original parameter up to the next/
.