Add routeEnum with validation and enhance error handling in BaseService [Twitter Gem TeamCity Packagist MozillaObservatory HexPm Greasyfork] - #11800
Conversation
|
…adges#11812) part of issue badges#3329 helps unblock badges#11800 Co-authored-by: Copilot <copilot@github.com>
replace `route`'s deprecated `format` with `pattern` part of badges#3329 helps badges#11800
…ce (badges#11858) replace `route`'s deprecated `format` with `pattern` part of badges#3329 helps badges#11800
firstParamName was used as litteral string insted of evaludating the value of the actual firstParamName extracted beforehand.
|
🚀 Updated review app: https://pr-11800-badges-shields.fly.dev |
| - `pattern` defines the variable part of the route, everything that comes after `/example/`. It can include any number of named parameters. These are converted into regular expressions by [`path-to-regexp`][path-to-regexp]. Because a service instance won't be created until it's time to handle a request, the route and other metadata must be obtained by examining the classes themselves. [That's why they're marked `static`.][static] | ||
| - There is additional documentation on conventions for [designing badge URLs](./badge-urls.md) | ||
|
|
||
| - `routeEnum` (optional): an array of strings that defines a finite set of allowed values for an enum-like parameter in the route. When `routeEnum` is present, the first named parameter in the route `pattern` is treated as the enum value to validate against `routeEnum`. |
There was a problem hiding this comment.
@jNullj was it intentional to drop the link to ./badge-urls.md in this commit? It felt useful to me.
There was a problem hiding this comment.
@PyvesB it looked like its getting a bit too convoluted with so many internal lines so i tried to reduce it a bit
i think it was nice to have but its one of the things i could cut out without hurting the main content.
i don't mind getting it back, let me see if i can make it a bit more clear this time
|
test failure: only gemrank failed, but it also fails in daily tests, we get timout and such, unrelated to this pr. |
|
moved it back to where it was, i just realized i moved it into routeEnum by mistake. |


A step towards #11371 and express.js
some impotent points: