grape
grape copied to clipboard
An opinionated framework for creating REST-like APIs in Ruby.
I've noticed that tempfiles created when uploading a file (Rack::Multipart) are not closed and unlink by default. Fortunately, Rack [provides](https://github.com/rack/rack/blob/main/lib/rack/tempfile_reaper.rb) a middleware for it and we just need to add...
Am I wrong to say that [Grape::Formatter::JSON](https://github.com/ruby-grape/grape/blob/2b8567a1ca49b3d0236fa82deb2edef34c8839cf/lib/grape/formatter/json.rb#L8) will never call `Grape::Json::Dump` since every object responds to `to_json` ? On the other hand, [Grape::ErrorFormatter::JSON](https://github.com/ruby-grape/grape/blob/2b8567a1ca49b3d0236fa82deb2edef34c8839cf/lib/grape/error_formatter/json.rb#L14) is not using `to_json`. I'm just concerned...
The purpose of a `rescue_from` block is of course to handle exceptions in a custom way. However, what should happen if the `rescue_from` block itself raises an exception? Currently, Grape...
I've [noticed](https://github.com/ruby-grape/grape/blob/56719693012269b0132d09e5e8fd41a906e38a6d/spec/grape/middleware/formatter_spec.rb#L176) that processing `application/json;q=invalid,application/xml;q=0.5` would set the `Grape::Env::API_FORMAT` to `xml` when it should be `json`. Unfortunately, the [RFC](https://datatracker.ietf.org/doc/html/rfc2616#section-14.1) isn't clear when `q` is not a float. Nonetheless the default...
Possible solution for #2482
Hello, If we define different properties required for array items by given condition then validation fails even if correct request is sent. Please check the example below: ```rb it 'test...
```ruby params do build_with Grape::Extensions::Hash::ParamBuilder requires :avatar, type: File end post '/' do ... end ``` Returns an error `#` because: - This line calls `deep_dup` of hash values (...
Is the Grape for Enterprise on the README correct? I was interested in providing financial support, but that link is a redirect now.
There are few places in the code that we `raise` an exception instead of throw `:error` and vice-versa. - [Grape::Middleware::Versioner::AcceptVersionHeader](https://github.com/ruby-grape/grape/blob/master/lib/grape/middleware/versioner/accept_version_header.rb) middleware is throwing but [Grape::Middleware::Versioner::Header](https://github.com/ruby-grape/grape/blob/master/lib/grape/middleware/versioner/header.rb) is raising. - [Running validators](https://github.com/ruby-grape/grape/blob/09e1bf544a86526ac15b3ea425da8a042c7dfc74/lib/grape/endpoint.rb#L307)...