Skip to content

Commit

Permalink
Properties are default optional but can be set to required. Fixes tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonMathis committed Aug 6, 2018
1 parent 99c6720 commit 365caf3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
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 << "optional" 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

0 comments on commit 365caf3

Please sign in to comment.