Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/active_support_functions' into a…
Browse files Browse the repository at this point in the history
…ctive_support_functions
  • Loading branch information
ericproulx committed May 13, 2023
2 parents be8dc68 + 70c92bc commit 7350fcb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
* [#2317](https://github.com/ruby-grape/grape/pull/2317): Remove maruku and rubocop-ast as direct development/testing dependencies - [@ericproulx](https://github.com/ericproulx).
* [#2292](https://github.com/ruby-grape/grape/pull/2292): Introduce Docker to local development - [@ericproulx](https://github.com/ericproulx).
* [#2325](https://github.com/ruby-grape/grape/pull/2325): Change edge test workflows only run on demand - [@dblock](https://github.com/dblock).
* [#2324](https://github.com/ruby-grape/grape/pull/2324): Expose default in the description dsl - [@dhruvCW](https://github.com/dhruvCW).
* [#2326](https://github.com/ruby-grape/grape/pull/2326): Use ActiveSupport extensions - [@ericproulx](https://github.com/ericproulx).

*
* Your contribution here.

#### Fixes
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ desc 'Returns your public timeline.' do
params API::Entities::Status.documentation
success API::Entities::Entity
failure [[401, 'Unauthorized', 'Entities::Error']]
default { code: 500, message: 'InvalidRequest', model: Entities::Error }
named 'My named route'
headers XAuthToken: {
description: 'Validates your identity',
Expand All @@ -663,8 +664,9 @@ end

* `detail`: A more enhanced description
* `params`: Define parameters directly from an `Entity`
* `success`: (former entity) The `Entity` to be used to present by default this route
* `failure`: (former http_codes) A definition of the used failure HTTP Codes and Entities
* `success`: (former entity) The `Entity` to be used to present the success response for this route.
* `failure`: (former http_codes) A definition of the used failure HTTP Codes and Entities.
* `default`: The definition and `Entity` used to present the default response for this route.
* `named`: A helper to give a route a name and find it with this name in the documentation Hash
* `headers`: A definition of the used Headers
* Other options can be found in [grape-swagger][grape-swagger]
Expand Down
3 changes: 2 additions & 1 deletion lib/grape/dsl/desc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ def desc_container(endpoint_configuration)
:produces,
:consumes,
:security,
:tags
:tags,
:default
)
config_context.define_singleton_method(:configuration) do
endpoint_configuration
Expand Down
2 changes: 2 additions & 0 deletions spec/grape/dsl/desc_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Dummy
detail: 'more details',
params: { first: :param },
entity: Object,
default: { code: 400, message: 'Invalid' },
http_codes: [[401, 'Unauthorized', 'Entities::Error']],
named: 'My named route',
body_name: 'My body name',
Expand Down Expand Up @@ -54,6 +55,7 @@ class Dummy
detail 'more details'
params(first: :param)
success Object
default code: 400, message: 'Invalid'
failure [[401, 'Unauthorized', 'Entities::Error']]
named 'My named route'
body_name 'My body name'
Expand Down

0 comments on commit 7350fcb

Please sign in to comment.