Commit 64ebd4c
committed
Tighten variant-type order, pop_desc nil semantics, document recovery scope
route.rb
- Convert the recovered VariantCollectionCoercer @types via #to_a so a
Set-backed coercer yields a deterministic order (insertion order from
the user's declaration), matching what `parse_multi_type` will pick
via `.first` downstream.
- Guard scope.full_name with `respond_to?` so a future CoerceValidator
built without @scope (custom subclasses, test doubles) degrades to
skipping that validator rather than crashing the whole swagger doc
generation with NoMethodError.
- Expand the leading comment to note that on Grape < 3.3 the recovery
is a no-op (the legacy `"[A, B]"` string is already handled by
parse_multi_type's regex branch), so a reader doesn't conclude the
defined? guard is silently overriding working behaviour.
doc_methods.rb (pop_desc)
- Use `key?` instead of `||` so an explicit `desc: nil` is respected
rather than silently falling through to `:description`. Document the
precedence inline (`:desc` wins when both keys are supplied).
specs
- Cover the new public-facing `:desc`/`:description`/string-key
semantics in api_documentation_spec so a future refactor can't
regress them silently.1 parent 0942165 commit 64ebd4c
3 files changed
Lines changed: 54 additions & 8 deletions
File tree
- lib/grape-swagger
- request_param_parsers
- spec/swagger_v2
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
142 | 144 | | |
143 | 145 | | |
144 | 146 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
57 | 61 | | |
58 | 62 | | |
59 | 63 | | |
| |||
66 | 70 | | |
67 | 71 | | |
68 | 72 | | |
69 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
70 | 76 | | |
| 77 | + | |
| 78 | + | |
71 | 79 | | |
72 | 80 | | |
73 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
26 | 62 | | |
0 commit comments