Comments (3)
I wanted to open an issue for discussion similar to this so might as well do it here. I wanted to recommend that upon registering a new route, router issues a fatal error in case it concludes there is an ambiguity. Router has no way of making a valid decision on what should be done, and this happened because of a programmer error which I think should crash on boot.
from routing-kit.
This is a limitation of the design of the router. A given node can have at most one wildcard child. In the above example, there is no way to distinguish between an Order
and Order.ID
component.
Since the Order
component is registered first, the router node is set as "order"
type. When the second route is registered, the router sees a parameter
path component is already there and uses that. There is no check as to whether the existing parameter type is the same.
A suggestion could be printing a warning (and perhaps failing) if non-matching paramater
type path components are registered to the same node. This could be done here.
from routing-kit.
This should be possible by adding a check that, if a dynamic child node already exists, its value is equal to the new dynamic node's value.
from routing-kit.
Related Issues (20)
- Incorrect Documentation for PathCompents
- add iOS platform in Package.swift
- how to get Anything parameter HOT 2
- Allow access to parameters HOT 6
- Avoid print in TrieRouter.swift HOT 3
- Only first route registration works HOT 7
- elementsEqual HOT 3
- Repo needs a pull request template
- Repo needs an issue template
- Integrate SwiftLint HOT 1
- Parameters should be percent escaped HOT 3
- Generalize route grouping
- Move percent encoding mechanism to Vapor HOT 2
- PathComponent.catchall not working as expected HOT 1
- Not working with localhost HOT 5
- Have to name all params the same HOT 1
- anything and parameter should be the same node HOT 8
- Trie Tree matching problem HOT 12
- Extraneous slashes and empty path components HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from routing-kit.