Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2c4f25a
Fix #394 API Blueprint: Add api_explanation in template
Aug 28, 2018
03e7d8c
Fix #394 Test description
Aug 28, 2018
eef2794
Fix #394 Remove non-existent line
Aug 28, 2018
d072044
Issues #191 #402 and #403: Add example property and remove duplicated…
Sep 14, 2018
f7d6e71
Fix Open API feature
Sep 14, 2018
7ec3886
Fix Open API feature
Sep 14, 2018
16da40d
Remove unneeded default values
aadityataparia Nov 30, 2018
8f5059b
Remove specs
aadityataparia Nov 30, 2018
06fba57
Fix spec
aadityataparia Nov 30, 2018
f923315
Add parameter defaults and enums to API Blueprint
Erol Dec 6, 2018
93b7a2e
Merge pull request #405 from SrMouraSilva/issues-393-402-403-open-api…
oestrich Dec 6, 2018
d6ce378
Allow raw API Blueprint annotations for describing object attributes
Erol Dec 6, 2018
9638903
Merge branch 'master' into aadi/remove_defaults
aadityataparia Dec 7, 2018
50c4330
Fix specs
aadityataparia Dec 7, 2018
57ece91
Merge pull request #420 from aadityataparia/aadi/remove_defaults
oestrich Dec 7, 2018
fa1c79a
Add specs
Erol Mar 14, 2019
1dcc7f8
Merge pull request #422 from Erol/add-parameter-defaults-and-enums-to…
oestrich Mar 14, 2019
e756b32
Fix issue with multiple required fields for open api
rennanoliveira Apr 15, 2019
54fbfda
Merge pull request #438 from rennanoliveira/fix-open-api-writer-required
oestrich Apr 24, 2019
4170469
Merge pull request #397 from SrMouraSilva/issue-394-apiblueprint-api_…
oestrich Aug 19, 2019
82c63d4
Add comment about response_status
duleorlovic Aug 30, 2019
5571121
Merge pull request #446 from duleorlovic/master
oestrich Aug 30, 2019
e850da7
Get rid of deprecated .should syntax in readme
psy-q Sep 18, 2019
81e5c56
Merge pull request #447 from psy-q/fix_rspec_syntax_deprecations
oestrich Sep 18, 2019
6d66f45
Remove child class gotcha
aadityataparia Dec 3, 2018
c052153
Remove child_class completely
aadityataparia Dec 3, 2018
af2b3ac
Add path root spec
aadityataparia Dec 3, 2018
a99015a
Change to open api spec 3.0
aadityataparia Dec 6, 2018
16e9084
added support for bearer authentication
ransingh May 24, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 21 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ resource "Orders" do
example "Listing orders" do
do_request

status.should == 200
expect(status).to eq 200
end
end
end
Expand Down Expand Up @@ -258,6 +258,7 @@ RspecApiDocumentation.configure do |config|
config.html_embedded_css_file = nil

# Removes the DSL method `status`, this is required if you have a parameter named status
# In this case you can assert response status with `expect(response_status).to eq 200`
config.disable_dsl_status!

# Removes the DSL method `method`, this is required if you have a parameter named method
Expand Down Expand Up @@ -360,7 +361,8 @@ This [format](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/

* Several new options on `parameter` helper.

- `with_example: true`. This option will adjust your description of the parameter with the passed value.
- `with_example: true`. This option will adjust your example of the parameter with the passed value.
- `example: <value>`. Will provide a example value for the parameter.
- `default: <value>`. Will provide a default value for the parameter.
- `minimum: <integer>`. Will setup upper limit for your parameter.
- `maximum: <integer>`. Will setup lower limit for your parameter.
Expand Down Expand Up @@ -515,18 +517,18 @@ resource "Account" do
# default :document is :all
example "Get a list of all accounts" do
do_request
status.should == 200
expect(status).to eq 200
end

# Don't actually document this example, purely for testing purposes
example "Get a list on page 2", :document => false do
do_request(:page => 2)
status.should == 404
expect(status).to eq 404
end

# With example_request, you can't change the :document
example_request "Get a list on page 3", :page => 3 do
status.should == 404
expect(status).to eq 404
end
end

Expand All @@ -535,12 +537,12 @@ resource "Account" do

example "Creating an account", :document => :private do
do_request(:email => "[email protected]")
status.should == 201
expect(status).to eq 201
end

example "Creating an account - errors", :document => [:private, :developers] do
do_request
status.should == 422
expect(status).to eq 422
end
end
end
Expand Down Expand Up @@ -609,7 +611,7 @@ resource "Orders" do
let(:id) { order.id }

example "Get an order" do
path.should == "/orders/1" # `:id` is replaced with the value of `id`
expect(path).to eq "/orders/1" # `:id` is replaced with the value of `id`
end
end

Expand Down Expand Up @@ -699,7 +701,7 @@ resource "Orders" do

get "/orders" do
example_request "Headers" do
headers.should == { "Accept" => "application/json", "X-Custom" => "dynamic" }
expect(headers).to eq { "Accept" => "application/json", "X-Custom" => "dynamic" }
end
end
end
Expand Down Expand Up @@ -738,7 +740,7 @@ resource "Orders" do
# OR let(:order_item_item_id) { 1 }

example "Creating an order" do
params.should eq({
expect(params).to eq({
:order => {
:name => "My Order",
:item => {
Expand Down Expand Up @@ -827,7 +829,7 @@ resource "Order" do

do_request

status.should == 200
expect(status).to eq 200
end
end
end
Expand All @@ -847,7 +849,7 @@ resource "Order" do
example "Listing orders" do
do_request

status.should == 200
expect(status).to eq 200
end
end
end
Expand All @@ -868,7 +870,7 @@ resource "Order" do

do_request

status.should == 200
expect(status).to eq 200
end
end
end
Expand All @@ -890,7 +892,7 @@ resource "Orders" do

get "/orders" do
example_request "Headers" do
headers.should == { "Accept" => "application/json" }
expect(headers).to eq { "Accept" => "application/json" }
end
end
end
Expand All @@ -910,7 +912,7 @@ resource "Order" do
example "Listing orders" do
do_request

response_body.should == [{ :name => "Order 1" }].to_json
expect(response_body).to eq [{ :name => "Order 1" }].to_json
end
end
end
Expand All @@ -926,7 +928,7 @@ resource "Order" do
example "Listing orders" do
do_request

response_headers["Content-Type"].should == "application/json"
expect(response_headers["Content-Type"]).to eq "application/json"
end
end
end
Expand All @@ -942,8 +944,8 @@ resource "Order" do
example "Listing orders" do
do_request

status.should == 200
response_status.should == 200
expect(status).to eq 200
expect(response_status).to eq 200
end
end
end
Expand All @@ -961,7 +963,7 @@ resource "Orders" do

get "/orders" do
example "List orders" do
query_string.should == "name=My+Orders"
expect(query_string).to eq "name=My+Orders"
end
end
end
Expand Down
14 changes: 14 additions & 0 deletions features/api_blueprint_documentation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ Feature: Generate API Blueprint documentation from test examples
attribute :name, 'The order name', required: true, :example => 'a name'
attribute :amount, required: false
attribute :description, 'The order description', type: 'string', required: false, example: "a description"
attribute :category, 'The order category', type: 'string', required: false, default: 'normal', enum: %w[normal priority]
attribute :metadata, 'The order metadata', type: 'json', required: false, annotation: <<-MARKDOWN
+ instructions (optional, string)
+ notes (optional, string)
MARKDOWN

get 'Returns a single order' do
explanation "This is used to return orders."
Expand Down Expand Up @@ -250,6 +255,7 @@ Feature: Generate API Blueprint documentation from test examples
"""
FORMAT: 1A
# Example API
Example API Description

# Group Instructions

Expand Down Expand Up @@ -360,6 +366,14 @@ Feature: Generate API Blueprint documentation from test examples
+ name: a name (required) - The order name
+ amount (optional)
+ description: a description (optional, string) - The order description
+ category (optional, string) - The order category
+ Default: `normal`
+ Members
+ `normal`
+ `priority`
+ metadata (optional, json) - The order metadata
+ instructions (optional, string)
+ notes (optional, string)

### Deletes a specific order [DELETE]

Expand Down
Loading