Commit 33a6dcb
committed
Adds API Blueprint
This commit adds API Blueprint (APIB) to this gem. A few highlights:
* APIB groups entities, resources, routes, HTTP verbs and requests
differently than what the gem currently uses. Because of that I had to
override more methods than usual in the `Markup` classes.
APIB has the following structure:
1. resource (e.g "Group Orders")
2. route (e.g "Orders Collection [/orders]")
3. HTTP method (e.g "Loads all orders [GET]")
4. Requests. Here, we show all different requests which means that
we don't have the repetition of GET for each example. All
examples stay under one, unified HTTP method header.
* APIB differentiates parameters (values used in the URLs) from
attributes (values used in the actual request body). You can use
`attributes` in your texts.
* APIB has a `route` header, which means we had to add a new RSpec block
called `route()` which wraps HTTP methods, like the following:
```ruby
route "/orders", "Orders Collection" do
get "Returns all orders" do
# ...
end
delete "Deletes all orders" do
# ...
end
end
```
If you don't use `route`, then param in `get(param)` should be an URL.
* APIB is not navigable like HTML, so generating an index file makes no
sense. Because of that, we are generating just one file, `index.apib`.
* We are omitting some APIB features in this version so we can get up
and running sooner. Examples are object grouping, arrays objects and a
few description points.
Unrelated to APIB:
* FakeFS was being used _globally_ in test mode, which means that
nothing would load file systems, not even a simple `~/.pry_history`, which
made debugging impossible. I moved the usage of this gem to the places
where it is used.
Closes #235.1 parent 470da85 commit 33a6dcb
File tree
20 files changed
+1027
-52
lines changed- features
- lib
- rspec_api_documentation
- dsl
- views
- writers
- spec
- views
- writers
- templates/rspec_api_documentation
20 files changed
+1027
-52
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
| 93 | + | |
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
| |||
170 | 171 | | |
171 | 172 | | |
172 | 173 | | |
| 174 | + | |
173 | 175 | | |
174 | 176 | | |
175 | 177 | | |
| |||
204 | 206 | | |
205 | 207 | | |
206 | 208 | | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
207 | 233 | | |
| 234 | + | |
208 | 235 | | |
209 | 236 | | |
210 | 237 | | |
| |||
0 commit comments