paperclip: Regression in 0.7.1 for actix web & tail matches

Looks like there has been a change to the way url path parameters are generated between 0.7.0 & 0.7.1. When using a tail match, which is normally defined by with a {param:.*} in the url, this now has broken output.

Here’s an example config:

cfg.service(web::resource("/example/{filename:.*}").route(web::get().to(get_example)))

This matches anything that has the /example/ prefix, including any extra slashes etc…

Here’s a diff of a service:

     "/example/{filename:.*}": {
       "get": {
         "operationId": "get_example",
         "parameters": [
           {
             "in": "path",
-            "name": "filename:.*",
+            "name": "filename",
             "required": true,
             "schema": {
               "type": "string"
             },
             "style": "simple"
           },

I would expect in this case the name still is filename:.*

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

Well, under the Path section for Patterned Fields, it doesn’t mention anything about regex at all… it seems to just mean the /some/{path} syntax. And also, the Patterned Fields refer to matching the path to use, not to restrict it like actix does, so it is a very different semantics.

     "/example/{filename}": {
       "get": {
         "operationId": "get_example",
         "parameters": [
           {
             "in": "path",
            "name": "filename",
             "required": true,
             "schema": {
               "type": "string",
               "pattern": ".*"
             },
             "style": "simple"
           },

is how I think the actix route

cfg.service(web::resource("/example/{filename:.*}").route(web::get().to(get_example)))

should be interpreted since in actix this means the path /example/{filename} where the filename matches ".**