Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions features/api_blueprint_documentation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -354,12 +354,12 @@ Feature: Generate API Blueprint documentation from test examples

+ Parameters
+ id: 1 (required, string) - Order id
+ optional
+ optional (optional)

+ Attributes (object)
+ name: a name (required) - The order name
+ amount
+ description: a description (string) - The order description
+ amount (optional)
+ description: a description (optional, string) - The order description

### Deletes a specific order [DELETE]

Expand Down
6 changes: 5 additions & 1 deletion lib/rspec_api_documentation/views/api_blueprint_index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ def fields(property_name, examples)
.uniq { |property| property[:name] }
.map do |property|
properties = []
properties << "required" if property[:required]
if property[:required] == true
properties << 'required'
else
properties << 'optional'
end
properties << property[:type] if property[:type]
if properties.count > 0
property[:properties_description] = properties.join(", ")
Expand Down
4 changes: 2 additions & 2 deletions spec/views/api_blueprint_index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
}, {
name: "option",
description: nil,
properties_description: nil
properties_description: 'optional'
}]
expect(post_route_with_optionals[:has_attributes?]).to eq false
expect(post_route_with_optionals[:attributes]).to eq []
Expand All @@ -159,7 +159,7 @@
required: false,
name: "description",
description: nil,
properties_description: nil
properties_description: "optional"
}]
end
end
Expand Down