File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed
lib/rspec_api_documentation/views Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -354,7 +354,7 @@ Feature: Generate API Blueprint documentation from test examples
354354 ]
355355 }
356356
357- ## Single Order [/orders{/ id}{?optional=:optional}]
357+ ## Single Order [/orders/{ id}{?optional=:optional}]
358358
359359 + Parameters
360360 + id: 1 (required, string) - Order id
Original file line number Diff line number Diff line change @@ -46,13 +46,13 @@ def examples
4646 private
4747
4848 # APIB follows the RFC 6570 to format URI templates.
49- # According to it, path segment expansion (used to describe URI path
50- # hierarchies ) should be represented by `{/ var}` and not by `/:var`
51- # For example `/posts/:id` should become `/posts{/ id}`
49+ # According to it, simple string expansion (used to perform variable
50+ # expansion ) should be represented by `{var}` and not by `/:var`
51+ # For example `/posts/:id` should become `/posts/{ id}`
5252 # cf. https://github.com/apiaryio/api-blueprint/blob/format-1A/API%20Blueprint%20Specification.md#431-resource-section
5353 # cf. https://tools.ietf.org/html/rfc6570#section-3.2.6
5454 def format_route ( example )
55- route_uri = example [ :route_uri ] . gsub ( /\/ :(.*?)([.\/ ?{]|$)/ , '{/ \1}\2' )
55+ route_uri = example [ :route_uri ] . gsub ( /:(.*?)([.\/ ?{]|$)/ , '{\1}\2' )
5656 "#{ route_uri } #{ example [ :route_optionals ] } "
5757 end
5858
Original file line number Diff line number Diff line change 109109
110110 post_examples = post_route [ :http_methods ] . map { |http_method | http_method [ :examples ] } . flatten
111111 expect ( post_examples . size ) . to eq 2
112- expect ( post_route [ :route ] ) . to eq "/posts{/ id}"
112+ expect ( post_route [ :route ] ) . to eq "/posts/{ id}"
113113 expect ( post_route [ :route_name ] ) . to eq "Single Post"
114114 expect ( post_route [ :has_parameters? ] ) . to eq true
115115 expect ( post_route [ :parameters ] ) . to eq [ {
130130
131131 post_w_optionals_examples = post_route_with_optionals [ :http_methods ] . map { |http_method | http_method [ :examples ] } . flatten
132132 expect ( post_w_optionals_examples . size ) . to eq 1
133- expect ( post_route_with_optionals [ :route ] ) . to eq "/posts{/ id}{?option=:option}"
133+ expect ( post_route_with_optionals [ :route ] ) . to eq "/posts/{ id}{?option=:option}"
134134 expect ( post_route_with_optionals [ :route_name ] ) . to eq "Single Post"
135135 expect ( post_route_with_optionals [ :has_parameters? ] ) . to eq true
136136 expect ( post_route_with_optionals [ :parameters ] ) . to eq [ {
You can’t perform that action at this time.
0 commit comments