Skip to content

Commit ca788ab

Browse files
committed
Added danger-toc, verify correct TOC.
1 parent b2b6c59 commit ca788ab

File tree

4 files changed

+40
-22
lines changed

4 files changed

+40
-22
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
* [#1686](https://github.com/ruby-grape/grape/pull/1686): Avoid coercion of a value if it is valid - [@timothysu](https://github.com/timothysu).
66
* [#1688](https://github.com/ruby-grape/grape/pull/1688): Removes yard docs - [@ramkumar-kr](https://github.com/ramkumar-kr).
7+
* [#1702](https://github.com/ruby-grape/grape/pull/1702): Added danger-toc, verify correct TOC in README - [@dblock](https://github.com/dblock).
78

89
#### Fixes
910

Dangerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
danger.import_dangerfile(gem: 'ruby-grape-danger')
2+
toc.check

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ group :test do
2929
gem 'mime-types'
3030
gem 'ruby-grape-danger', '~> 0.1.0', require: false
3131
gem 'coveralls', '~> 0.8.17', require: false
32+
gem 'danger-toc', '~> 0.1.0'
3233
end

README.md

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
- [Parameters](#parameters)
3232
- [Params Class](#params-class)
3333
- [Declared](#declared)
34+
- [Include Parent Namespaces](#include-parent-namespaces)
3435
- [Include Missing](#include-missing)
3536
- [Parameter Validation and Coercion](#parameter-validation-and-coercion)
3637
- [Supported Parameter Types](#supported-parameter-types)
@@ -44,12 +45,24 @@
4445
- [Group Options](#group-options)
4546
- [Alias](#alias)
4647
- [Built-in Validators](#built-in-validators)
48+
- [`allow_blank`](#allowblank)
49+
- [`values`](#values)
50+
- [`except_values`](#exceptvalues)
51+
- [`regexp`](#regexp)
52+
- [`mutually_exclusive`](#mutuallyexclusive)
53+
- [`exactly_one_of`](#exactlyoneof)
54+
- [`at_least_one_of`](#atleastoneof)
55+
- [`all_or_none_of`](#allornoneof)
56+
- [Nested `mutually_exclusive`, `exactly_one_of`, `at_least_one_of`, `all_or_none_of`](#nested-mutuallyexclusive-exactlyoneof-atleastoneof-allornoneof)
4757
- [Namespace Validation and Coercion](#namespace-validation-and-coercion)
4858
- [Custom Validators](#custom-validators)
4959
- [Validation Errors](#validation-errors)
5060
- [I18n](#i18n)
51-
- [Custom Validation Messages](#custom-validation-messages)
52-
- [Headers](#headers)
61+
- [Custom Validation messages](#custom-validation-messages)
62+
- [`presence`, `allow_blank`, `values`, `regexp`](#presence-allowblank-values-regexp)
63+
- [`mutually_exclusive`](#mutuallyexclusive-1)
64+
- [Overriding Attribute Names](#overriding-attribute-names)
65+
- [With Default](#with-default)
5366
- [Routes](#routes)
5467
- [Helpers](#helpers)
5568
- [Path Helpers](#path-helpers)
@@ -63,6 +76,8 @@
6376
- [Default Error HTTP Status Code](#default-error-http-status-code)
6477
- [Handling 404](#handling-404)
6578
- [Exception Handling](#exception-handling)
79+
- [Rescuing exceptions inside namespaces](#rescuing-exceptions-inside-namespaces)
80+
- [Unrescuable Exceptions](#unrescuable-exceptions)
6681
- [Rails 3.x](#rails-3x)
6782
- [Logging](#logging)
6883
- [API Formats](#api-formats)
@@ -78,6 +93,8 @@
7893
- [Active Model Serializers](#active-model-serializers)
7994
- [Sending Raw or No Data](#sending-raw-or-no-data)
8095
- [Authentication](#authentication)
96+
- [Basic and Digest Auth](#basic-and-digest-auth)
97+
- [Register custom middleware for authentication](#register-custom-middleware-for-authentication)
8198
- [Describing and Inspecting an API](#describing-and-inspecting-an-api)
8299
- [Current Route and Endpoint](#current-route-and-endpoint)
83100
- [Before and After](#before-and-after)
@@ -88,13 +105,22 @@
88105
- [Remote IP](#remote-ip)
89106
- [Writing Tests](#writing-tests)
90107
- [Writing Tests with Rack](#writing-tests-with-rack)
108+
- [RSpec](#rspec)
109+
- [Airborne](#airborne)
110+
- [MiniTest](#minitest)
91111
- [Writing Tests with Rails](#writing-tests-with-rails)
112+
- [RSpec](#rspec-1)
113+
- [MiniTest](#minitest-1)
92114
- [Stubbing Helpers](#stubbing-helpers)
93115
- [Reloading API Changes in Development](#reloading-api-changes-in-development)
94116
- [Reloading in Rack Applications](#reloading-in-rack-applications)
95117
- [Reloading in Rails Applications](#reloading-in-rails-applications)
96118
- [Performance Monitoring](#performance-monitoring)
97119
- [Active Support Instrumentation](#active-support-instrumentation)
120+
- [endpoint_run.grape](#endpointrungrape)
121+
- [endpoint_render.grape](#endpointrendergrape)
122+
- [endpoint_run_filters.grape](#endpointrunfiltersgrape)
123+
- [endpoint_run_validators.grape](#endpointrunvalidatorsgrape)
98124
- [Monitoring Products](#monitoring-products)
99125
- [Contributing to Grape](#contributing-to-grape)
100126
- [License](#license)
@@ -645,7 +671,7 @@ curl -X GET -H "Content-Type: application/json" localhost:9292/parent/foo/bar
645671
}
646672
````
647673

648-
### Include missing
674+
### Include Missing
649675

650676
By default `declared(params)` includes parameters that have `nil` values. If you want to return only the parameters that are not `nil`, you can use the `include_missing` option. By default, `include_missing` is set to `true`. Consider the following API:
651677

@@ -888,8 +914,6 @@ class Color
888914
end
889915
end
890916

891-
# ...
892-
893917
params do
894918
requires :color, type: Color, default: Color.new('blue')
895919
end
@@ -957,8 +981,6 @@ get '/' do
957981
params[:json].inspect
958982
end
959983

960-
# ...
961-
962984
client.get('/', json: '{"int":1}') # => "{:int=>1}"
963985
client.get('/', json: '[{"int":"1"}]') # => "[{:int=>1}]"
964986

@@ -994,8 +1016,6 @@ get '/' do
9941016
params[:status_code].inspect
9951017
end
9961018

997-
# ...
998-
9991019
client.get('/', status_code: 'OK_GOOD') # => "OK_GOOD"
10001020
client.get('/', status_code: 300) # => 300
10011021
client.get('/', status_code: %w(404 NOT FOUND)) # => [404, "NOT", "FOUND"]
@@ -1012,8 +1032,6 @@ get '/' do
10121032
params[:status_codes].inspect
10131033
end
10141034

1015-
# ...
1016-
10171035
client.get('/', status_codes: %w(1 two)) # => [1, "two"]
10181036
```
10191037

@@ -1589,7 +1607,7 @@ en:
15891607
name_required: 'must be present'
15901608
```
15911609

1592-
#### `Overriding attribute names`
1610+
#### Overriding Attribute Names
15931611

15941612
You can also override attribute names.
15951613

@@ -1607,7 +1625,7 @@ en:
16071625
```
16081626
Will produce 'Oops! Name must be present'
16091627

1610-
#### `With Default`
1628+
#### With Default
16111629

16121630
You cannot set a custom message option for Default as it requires interpolation `%{option1}: %{value1} is incompatible with %{option2}: %{value2}`. You can change the default error message for Default by changing the `incompatible_option_values` message key inside [en.yml](lib/grape/locale/en.yml)
16131631

@@ -2282,7 +2300,6 @@ class API < Grape::API
22822300
end
22832301
end
22842302
post '/statuses' do
2285-
# ...
22862303
logger.info "#{current_user} has statused"
22872304
end
22882305
end
@@ -2925,9 +2942,7 @@ If a request for a resource is made that triggers the built-in `OPTIONS` handler
29252942
only `before` and `after` callbacks will be executed. The remaining callbacks will
29262943
be bypassed.
29272944

2928-
#### Examples
2929-
2930-
Using a simple `before` block to set a header
2945+
For example, using a simple `before` block to set a header.
29312946

29322947
```ruby
29332948
before do
@@ -2963,7 +2978,7 @@ class MyAPI < Grape::API
29632978
end
29642979
```
29652980

2966-
The behaviour is then:
2981+
The behavior is then:
29672982

29682983
```bash
29692984
GET / # 'root - '
@@ -2991,7 +3006,7 @@ class MyAPI < Grape::API
29913006
end
29923007
```
29933008

2994-
The behaviour is then:
3009+
The behavior is then:
29953010

29963011
```bash
29973012
GET /123 # 'Integer'
@@ -3026,7 +3041,7 @@ class Test < Grape::API
30263041
end
30273042
```
30283043

3029-
The behaviour is then:
3044+
The behavior is then:
30303045

30313046
```bash
30323047
GET /foo/v1 # 'v1-hello'
@@ -3051,7 +3066,7 @@ class MyAPI < Grape::API
30513066
end
30523067
```
30533068

3054-
The behaviour is then:
3069+
The behavior is then:
30553070

30563071
```bash
30573072
GET /greeting # {"greeting":"Hello!"}
@@ -3339,7 +3354,7 @@ describe 'an endpoint that needs helpers stubbed' do
33393354
end
33403355

33413356
it 'stubs the helper' do
3342-
# ...
3357+
33433358
end
33443359
end
33453360
```

0 commit comments

Comments
 (0)