Skip to content

Conversation

spaceraccoon
Copy link
Contributor

@spaceraccoon spaceraccoon commented Oct 13, 2022

As per #873, Ruby on Rails supports wildcard segments, such as:

get 'books/*section/:title'

would match books/some/section/last-words-a-memoir with params[:section] equals 'some/section', and params[:title] equals 'last-words-a-memoir'.

However, grape-swagger does not recognise these wildcard segments as path parameters. For example:

get 'books/*section/:title' 

would generate:

"paths": {
  "/api/v2/books/*section/{title}": {
    "get": {
    ...
      "parameters": [
         {
           "in": "query", "name": "*section"
           ...
  }
}

instead of the expected:

"paths": {
  "/api/v2/books/{section}/{title}": {
    "get": {
    ...
      "parameters": [
         {
           "in": "path", "name": "section"
           ...
  }
}

grape-swagger should also recognise wildcard segments as path parameters.

This adds support for wildcard segments, all tests passing locally.

@spaceraccoon spaceraccoon force-pushed the spaceraccoon-add-wildcard-segments-parameters branch from 7ec327f to 3262908 Compare October 13, 2022 05:41
@spaceraccoon
Copy link
Contributor Author

@LeFnord for your review please :)

@spaceraccoon spaceraccoon force-pushed the spaceraccoon-add-wildcard-segments-parameters branch from 3262908 to 3af0f34 Compare November 11, 2022 03:43
@LeFnord
Copy link
Member

LeFnord commented Feb 19, 2023

@spaceraccoon … again sorry … please can you fix the conflicts, thanks

@LeFnord
Copy link
Member

LeFnord commented Feb 19, 2023

and maybe squash some of your PR …

this one would be nice come together with #879

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
close