Stop populating the write-only namespace description in desc#2787
Conversation
22c44e2 to
3532917
Compare
Danger ReportNo issues found. |
`desc` stored its settings under both the route scope (`route_setting(:description)`) and the namespace scope (`namespace_setting(:description)`). The namespace copy was never read: `route` consumes only `route[:description]`, the namespace scope is not wired for inheritance (`InheritableSetting#inherit_from` skips `@namespace`), and grape-swagger reads neither. `desc` now writes only the route scope. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
3532917 to
9b6eeae
Compare
|
Can a namespace have its own/different description? |
|
No — and it couldn't before this PR either. What desc 'namespace-level description'
namespace :users do
get :first # description: "namespace-level description"
desc 'route-level description'
get :second # "route-level description"
get :third # nil
endSo routes inside a namespace can each have their own description, exactly as before. For metadata on the namespace itself, the supported channel is options on the (Side note: an unconsumed |
Yes, this looks unexpected. I think |
descwrote its settings into two places — the route scope (route_setting(:description)) and the namespace scope (namespace_setting(:description)) — but the namespace copy was pure dead state:route[:description](inroute(), and only for the:paramskey).InheritableSetting#inherit_fromsetsinherited_valuesfornamespace_inheritable/namespace_stackable/namespace_reverse_stackableand mergesroute, but never touches@namespace. So namespace-scope values are only cloned bypoint_in_time_copyand never consulted.Confirmed by experiment: dropping the write breaks only the
desc_spec.rbassertions that checked the write itself — the rest of the suite is unaffected.Change
descnow writes only the route scope.namespace_setting(:description)returnsnil; a route's description remains available viaroute_setting(:description)and theroute.descriptionreader. UPGRADING note added.Full suite green (2351 examples, 0 failures); RuboCop clean.
🤖 Generated with Claude Code