Skip to content

Commit fc5b3e7

Browse files
committed
fix: remove humanized descriptions from API Blueprint output
When parameters or attributes are defined without explicit descriptions, the DSL auto-generates humanized descriptions (e.g., "option" -> "Option"). This change ensures these auto-generated descriptions are not included in the API Blueprint output, providing cleaner documentation. - Added humanize check to description_blank? method - Updated RSpec tests to expect nil for auto-generated descriptions - Fixes failing cucumber test for API Blueprint documentation
1 parent 50f0de7 commit fc5b3e7

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/rspec_api_documentation/views/api_blueprint_index.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ def fields(property_name, examples)
103103
# equals the name, I assume it is blank.
104104
def description_blank?(property)
105105
!property[:description] ||
106-
property[:description].to_s.strip == property[:name].to_s.strip
106+
property[:description].to_s.strip == property[:name].to_s.strip ||
107+
property[:description].to_s.strip == property[:name].to_s.humanize
107108
end
108109
end
109110
end

spec/views/api_blueprint_index_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
properties_description: "required, string"
143143
}, {
144144
name: "option",
145-
description: 'Option',
145+
description: nil,
146146
properties_description: 'optional'
147147
}]
148148
expect(post_route_with_optionals[:has_attributes?]).to eq false
@@ -158,7 +158,7 @@
158158
expect(posts_route[:attributes]).to eq [{
159159
required: false,
160160
name: "description",
161-
description: 'Description',
161+
description: nil,
162162
properties_description: "optional"
163163
}]
164164
end

0 commit comments

Comments
 (0)