Skip to content

Dead code in ParamLocationResolver after merging #145 and #146 #148

Description

@numbata

Problem

Neither PR #145 nor #146 leaves this dead code on its own, but merging both does. #145 refactored the old body-detection check into two helpers on ParamLocationResolver:

def self.body_param?(spec)
  body_annotation?(spec) || [Hash, "Hash"].include?(spec[:type])
end

def self.body_annotation?(spec)
  explicit_location(spec) == "body"
end

#146 independently replaced build_flat_params's call site (next if location_resolver.body_param?(spec)) with a direct type check (next if [Hash, "Hash"].include?(spec[:type])). Once both land, body_param? has zero callers in lib/ or test/, and body_annotation? is only called by the now-dead body_param?.

Fix

Delete both methods from lib/grape_oas/api_model_builders/request_params_support/param_location_resolver.rb in a follow-up commit, and confirm no other callers exist via a repo-wide search first.

Why this matters

Left in place, the methods are harmless today but are a trap: someone could later wire body_param? back into a call site without realizing it silently reintroduces the bug #146 fixed (path parameters inheriting param_type: "body" from an outer group getting skipped).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions