Fork me on GitHub
#reitit
<
2018-05-28
>
delaguardo15:05:01

Hi there! I’m trying to adopt swagger(-ui) feature with reitit but looks like the generated swagger.json doesn’t conform with PathsObject specification. Especially pathTemplating part - https://github.com/reverb/swagger-spec/blob/master/versions/2.0.md#pathTemplating It expects curly braces instead of colon prefix notation.

ikitommi15:05:35

@delaguardo oh, needs fixing then. Would you like to do a PR?

ikitommi15:05:18

Hmm... I though I added swagger validator tests, but can't see any.

delaguardo15:05:12

I will try to do a PR

👍 4
skammer16:05:34

It seems like trailing slashes confuse reitit and don’t resolve properly. This works (reitit.core/match-by-path router "/dashboard") ;=> #reitit.core.Match{ ... } but this doesn’t (reitit.core/match-by-path router "/dashboard/") ;=> nil

skammer16:05:23

Is this the intended behaviour, and if so, what is the idiomatic way of matching both routes to the same route name?

ikitommi18:05:25

@skammer currently, there is no way, but this should be resolved. I wrote https://github.com/metosin/reitit/issues/92 for this. Ideas welcome.

eskos16:06:17

Independent of what strategy is chosen, there should be clear distinction between rerouting trailing-slash paths to non-trailing-slash paths, serving specific versions and allowing/disallowing extraneous slashes in between (is /some///silly////path// same as /some/silly/path?) And especially for static resource resolution this might become quite important as /path/ indicates a directory while /path indicates a file which ,may be abused to access eg. files in same root as intended resource directory itself.

eskos16:06:50

This is one of those problems I've never found a good solution for that I'd be 100% happy but that doesn't mean there wouldn't be one 🙂

ikitommi18:05:33

we have a project deadline on friday, more time next week time (for the frontend-module too).

ikitommi19:05:57

e.g. the current good practise would be to do it yourself: if there is no match, try without a trailing slash, if still nothing, try with trailing slash added. let’s make something better out of this.