Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type, description and documentation is ignored when mounting class inside route_param #942

Closed
4ndv opened this issue Oct 12, 2024 · 0 comments · Fixed by #943
Closed

Type, description and documentation is ignored when mounting class inside route_param #942

4ndv opened this issue Oct 12, 2024 · 0 comments · Fixed by #943

Comments

@4ndv
Copy link
Contributor

4ndv commented Oct 12, 2024

Example:

class MyApi < Grape::API
  route_param :account_id, type: String, desc: 'id of account', documentation: { desc: 'another-desc' } do
    mount AccountsApi

    get '/another-list' do
      []
    end
  end

  add_swagger_documentation
end

class AccountsApi < Grape::API
  get '/list' do
    []
  end
end

Resulting documentation:

"/{account_id}/list": {
  "get": {
    "parameters": [
      {
        "in": "path",
        "name": "account_id",
        "type": "integer",
        "format": "int32",
        "required": true
      }
    ],
  }
},
"/{account_id}/another-list": {
  "get": {
    "parameters": [
      {
        "in": "path",
        "name": "account_id",
        "type": "string",
        "required": true
      }
    ],
  }
}
  • For account_id param of /list type is incorrect, description and documentation is ignored
  • For account_id param of /another-list type is correct, but description and documentation is still ignored
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant