Phoenix.Router - (re)name param inside nested resources

When nesting resources Phoenix changes param names.
The following example shows a param called slug which is renamed stuff_slug while it’s exactly the same param.

  scope "/x/", MyAppWeb do
    pipe_through [:browser, :protected]

    get "/", OuterController, :index do
      resources "/stuff", StuffController, as: :thing, param: "slug" do
        patch "/publish", InnerController, :update, as: :publish
      end
    end
  end

mix phx.routes

          outer_path  GET     /x                            MyAppWeb.OuterController :index
          thing_path  GET     /x/stuff                      MyAppWeb.StuffController :index
          thing_path  GET     /x/stuff/:slug/edit           MyAppWeb.StuffController :edit
          thing_path  GET     /x/stuff/new                  MyAppWeb.StuffController :new
          thing_path  GET     /x/stuff/:slug                MyAppWeb.StuffController :show
          thing_path  POST    /x/stuff                      MyAppWeb.StuffController :create
          thing_path  PATCH   /x/stuff/:slug                MyAppWeb.StuffController :update
                      PUT     /x/stuff/:slug                MyAppWeb.StuffController :update
          thing_path  DELETE  /x/stuff/:slug                MyAppWeb.StuffController :delete
  thing_publish_path  PATCH   /x/stuff/:stuff_slug/publish  MyAppWeb.InnerController :update

How should Phoenix.Router be instructed to produce the following result:

  thing_publish_path  PATCH   /x/stuff/:slug/publish        MyAppWeb.InnerController :update

Thank you.

For the time being I will solve the above problem like this:

defmodule MyAppWeb.SanitizeParamsPlug do
  @behaviour Plug


  def init(_opts), do: nil

  def call(conn, _opts) do
    %{conn | params: sanitize(conn.params)}
  end

  # private

  defp sanitize(params) do
    for {k, v} <- params, into: %{} do
      {rename(k), v}
    end
  end

  defp rename("stuff_slug"), do: "slug"
    
  defp rename(k), do: k

end