url-pattern
url-pattern copied to clipboard
Support for curly brackets url syntax
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
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.
Can I take up this issue? Are you looking to accept a PR for this?
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
ok sure.