Problem/Motivation

Two resources take the entity of the route as an argument: the branch endpoint and the service endpoint, both routed as /{taxonomy_term}. Their methods declare that argument as $taxonomyTerm, and core resolves controller arguments by matching the name of the parameter in the route - taxonomy_term - against the name of the argument. The two never match, so every request to either endpoint ends in RuntimeException: Callable ... requires a value for the "$taxonomyTerm" argument and answers 500.

It has been that way since the variables of the module were renamed to camelCase: the rename was right everywhere else and wrong exactly here, where the name is not a local matter but a contract with the router. Nothing caught it because no test asked for either endpoint, and both take an argument, which is what kept them out of every walk over the endpoints.

Proposed resolution

  • Name the argument the way the route names the parameter, in both resources.
  • Cover both endpoints with a test that asks for them with a real term, so the contract is asserted rather than assumed.
  • Check every resource whose route carries a placeholder for the same mismatch - the ones taking {node} are fine because the name survived the rename, but the check belongs in the issue rather than in somebody's memory.

Remaining tasks

Everything.

Issue fork myrest-3619473

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

sergeydruua created an issue. See original summary.

  • sergeydruua committed 2570edce on 1.0.x
    Issue #3619473: Name the argument of the term endpoints after the route...
sergeydruua’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

sergeydruua’s picture

Status: Fixed » Closed (fixed)