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

Parse route_param type for nested endpoints #847

Merged
merged 8 commits into from
Jul 26, 2022

Conversation

dmoss18
Copy link
Contributor

@dmoss18 dmoss18 commented Feb 24, 2022

We noticed that when we did this:

resource :accounts do
  route_param :account_number, type: String do
    resource :records do
      route_param :id do
        get do
          ...
        end
      end
    end
  end
end

The type of account_number is defaulted to integer. Grape doesn't include any options in declared_params, so this code parses any parent namespaces and builds a mapping declared_params to their options.

Copy link
Member

@LeFnord LeFnord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @dmoss18 for the fix

please can you change the specs … maybe they are running only if grape '~> 1.6' is loaded or so

Gemfile Outdated Show resolved Hide resolved
@dmoss18
Copy link
Contributor Author

dmoss18 commented May 31, 2022

@LeFnord I'm having a hard time getting Ruby version 3.2.0dev installed locally. It seems to be downloading it straight from ruby-dev-builds. The best I could do is install 3.2.0-preview1 locally, and all spec tests passed with that version.

Do you have any tips I could try to get these tests to fail like they do in CI?

@LeFnord
Copy link
Member

LeFnord commented Jul 26, 2022

thanks @dmoss18

@LeFnord LeFnord merged commit 908a7a8 into ruby-grape:master Jul 26, 2022
aka-momo pushed a commit to aka-momo/grape-swagger that referenced this pull request Feb 8, 2023
* Fix documentation of `route_param` type when used with nested endpoints

* Rubocop fixes

* Rubocop fixes

* grape 1.6

Co-authored-by: peter scholz <pscholz.le@gmail.com>
Bhacaz pushed a commit to Bhacaz/grape-swagger that referenced this pull request Aug 31, 2023
* Fix documentation of `route_param` type when used with nested endpoints

* Rubocop fixes

* Rubocop fixes

* grape 1.6

Co-authored-by: peter scholz <pscholz.le@gmail.com>
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 this pull request may close these issues.

2 participants