Giter VIP home page Giter VIP logo

Comments (5)

dougwilson avatar dougwilson commented on August 27, 2024

Though I don't see it in the readme, the only supported tokens are those in the JavaScript "\w" set, mainly because the patterns were originally designed in Express 4 for use in JavaScript variables and properties.

I don't have an opinion on supporting the dash, only would note that it would be a breaking change in behavior (think of the route "/:lang-:country/*").

from path-to-regexp.

whitlockjc avatar whitlockjc commented on August 27, 2024

Thanks for responding. I'll let @theganyo read up on this since he was the original reporter and we'll go from there.

from path-to-regexp.

blakeembrey avatar blakeembrey commented on August 27, 2024

@whitlockjc Doug beat me to it, and this should be added to the README, but it's not supported and likely won't be.

As a side note, I don't know how you're technically handling Swagger documents and path syntax, but for RAML I implemented a custom path matcher implementation and eventually a router (since RAML does validation on URI parameters). It's likely you don't need to do that - Swagger is only Level 1 Template URIs right? (@dougwilson, this might be interesting going to back when you mentioned having a router that supported the RFC for template URIs). I couldn't find where you were actually handling the path stuff to create middleware, so this is just a brain dump of information.

Side note: I was reading through https://github.com/apigee-127/swagger-tools/blob/408e252345578716bd52b607948e287a2eb196c2/middleware/swagger-metadata.js#L327-L330 and I think it's a bug? The expressPath never has { since you just replaced all the instances with : a few lines above.

from path-to-regexp.

whitlockjc avatar whitlockjc commented on August 27, 2024

I'm not sure why you couldn't support - but I'm not advocating for it either. I mean, if I wanted to have a parameter named some-path, I don't see why I couldn't have /path/:some-path without breaking /path/:some-:path. But again, I'm not asking for it.

As for the potential bug in swagger-tools' swagger-metadata middleware, I do think you've found a bug and I'll report it. Speaking of Swagger, I wonder what @webron thinks about this. I wonder if there is some undocumented limitations for the variable names in Swagger path templating. Regardless, I can bring it up in swagger-tools.

Thanks a lot for looking into this.

from path-to-regexp.

webron avatar webron commented on August 27, 2024

Just replied to the linked topic, but for ease I'll quote it here:

The Swagger spec doesn't provide specific details about it.

However, following RFC 6570 it looks like characters other than alphanumeric or underscore cannot be used unless they are decoded. I'd leave the decision on whether to support it up to you, but I believe it's ok to not provide support for it.

For non-Swagger related tools, if you follow support for the RFC, then you probably wouldn't want to add support for it.

from path-to-regexp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.