Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle wildcard in URI template #49

Open
hnafar opened this issue Apr 18, 2018 · 1 comment
Open

handle wildcard in URI template #49

hnafar opened this issue Apr 18, 2018 · 1 comment
Labels
enhancement help wanted This issue is available to submit a pull request for

Comments

@hnafar
Copy link

hnafar commented Apr 18, 2018

Add support for parsing wildcard parameter in UriTemplate. From https://github.com/dotnet/corefx/issues/24652#issuecomment-381698515

var template = new UriTemplate("http://localhost/{/x}", false)
var values = template.GetParameters("http://localhost/foo/1/"); // currently values is null, should bind x to "foo/1"

see https://tools.ietf.org/html/rfc6570#section-3.2.6
also see OAI/OpenAPI-Specification#291 for a related discussion

Will be happy to work on this and make a pull request if you point me in the right direction

@darrelmiller
Copy link
Member

Hey @hnafar multi-segment path parameters is something we would definitely like to add in OAS 3.1 (see list here )

And therefore yes, I would love to see support for it in Tavis.UriTemplate. Unfortunately, I don't have time to work on it right now. If you want to give it a try, then I would start by looking at this test:

        public void OptionalPathParam()
        {
            var uri = new Uri("/foo/yuck/bob", UriKind.RelativeOrAbsolute);
            var template = new UriTemplate("/foo{/bar}/bob");
            var parameters = template.GetParameters(uri);

            Assert.Equal("yuck", parameters["bar"]);
        }

This test works. However, the part that is missing is knowing when there are multiple segments that belong to the parameter.

@baywet baywet added enhancement help wanted This issue is available to submit a pull request for labels Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement help wanted This issue is available to submit a pull request for
Projects
None yet
Development

No branches or pull requests

3 participants