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

Support for curly brackets url syntax #49

Open
danday74 opened this issue Mar 29, 2018 · 4 comments
Open

Support for curly brackets url syntax #49

danday74 opened this issue Mar 29, 2018 · 4 comments

Comments

@danday74
Copy link

I understand most libraries use:

/users/:id

but Swagger, the no1 lib for defining API contracts and mocking, uses:

/users/{id}

I need to parse the Swagger-style syntax.

This is a request for that support to be added.

Thanks

@snd snd added the help wanted label Apr 1, 2018
@snd
Copy link
Owner

snd commented Apr 1, 2018

this could be solved cleanly by adding and implementing an optional segmentNameEndChar option.

then one should be able to configure url-pattern with the following options to do what you want:

{
  segmentNameStartChar: "{",
  segmentNameEndChar: "}",
}

i don't have time to do that right now.
going to wait to see whether there is more demand for this.

@arpitsingh94
Copy link

Can I take up this issue? Are you looking to accept a PR for this?

@snd
Copy link
Owner

snd commented Apr 29, 2019

hey @arpitsingh94,

i'm in the process of converting url-pattern from coffeescript to typescript on this branch: https://github.com/snd/url-pattern/tree/coffeescript-to-typescript

the code conversion is done and the tests still pass.
i just need to adapt the rest of the repo to it.
once that is complete you're very welcome to tackle this issue.

i'll post a note here once the conversion is complete

@arpitsingh94
Copy link

ok sure.

snd added a commit that referenced this issue Apr 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants