Custom `input_type` for Custom Structs

I need to create a form for custom defined struct which has another nested struct (to be represented as formarray)

%MyOuterStruct{ key: :value,
inner_key: 
%{16=> %InnerStruct{key2: :value2}, 
  17=> %InnerStruct{key2: :value3} 
}

I have defined changesets for both of these structs in their respective files.

Issue I am facing:

no function clause matching in Phoenix.HTML.Form.input_type/3

Called with 3 arguments
%{16 => %InnerStruct{key2: value}}

:inner

%{"email" => :email_input, "password" => :password_input, "search" => :search_input, "url" => :url_input}

basically in a liveview form:

... 

<%= create_inner f.data.outer.inner ,:inner %>

...

and input_helpers.ex contain


  def create_inner(form, field, input_opts \\ [], data \\ []) do
   type = HTML.Form.input_type(form, field) |> IO.inspect(label: "type of input")

.... more code ... 
end

How do I create a custom input helper for my nested struct?

Usually you’d use inputs_for in this situation; I’m not sure if that’s a good fit depending on what the keys inside of inner_key (16 and 17 in the example) mean.

What shape of parameters is your event handling / changeset code expecting for MyOuterStruct?

16 and 17 are integer keys.

changeset code for outerstruct :

%MyOuterStruct{ key: :value,
inner_key: 
%{16=> %InnerStruct{key2: :value2}, 
  17=> %InnerStruct{key2: :value3} 
}

we have typed structs and not using ecto schemas.
So, changesets for OuterStruct is written in a way that it invokes changeset for nested structs.