File tree 2 files changed +7
-7
lines changed
lib/rspec_api_documentation/views 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -46,13 +46,13 @@ def examples
46
46
private
47
47
48
48
# 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}`
52
52
# cf. https://github.com/apiaryio/api-blueprint/blob/format-1A/API%20Blueprint%20Specification.md#431-resource-section
53
- # cf. https://tools.ietf.org/html/rfc6570#section-3.2.6
53
+ # cf. https://tools.ietf.org/html/rfc6570#section-3.2.2
54
54
def format_route ( example )
55
- route_uri = example [ :route_uri ] . gsub ( /\/ :(.*?)([.\/ ?{]|$)/ , '{/ \1}\2' )
55
+ route_uri = example [ :route_uri ] . gsub ( /:(.*?)([.\/ ?{]|$)/ , '{\1}\2' )
56
56
"#{ route_uri } #{ example [ :route_optionals ] } "
57
57
end
58
58
Original file line number Diff line number Diff line change 109
109
110
110
post_examples = post_route [ :http_methods ] . map { |http_method | http_method [ :examples ] } . flatten
111
111
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}"
113
113
expect ( post_route [ :route_name ] ) . to eq "Single Post"
114
114
expect ( post_route [ :has_parameters? ] ) . to eq true
115
115
expect ( post_route [ :parameters ] ) . to eq [ {
130
130
131
131
post_w_optionals_examples = post_route_with_optionals [ :http_methods ] . map { |http_method | http_method [ :examples ] } . flatten
132
132
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}"
134
134
expect ( post_route_with_optionals [ :route_name ] ) . to eq "Single Post"
135
135
expect ( post_route_with_optionals [ :has_parameters? ] ) . to eq true
136
136
expect ( post_route_with_optionals [ :parameters ] ) . to eq [ {
You can’t perform that action at this time.
0 commit comments