Ecto cast_assoc - %UndefinedFunctionError

Will love some advice

Basically i have a map comprising of another nested map.

I am using Ecto.Changeset to cast the values and validate them

    input: 
   { document: {"id": 2091}, players: ["1", "2"], details: {"code": "100", "id: "saas"}}

    data = %{}
    types = %{document: :map, players: {:array, :string}, details: :assoc}
    details_types = %{code: :string, id: :string}

    changeset =
    {data, types}
    |> Changeset.cast(input, Map.keys(types))
    |> Changeset.cast_assoc(:details, Map.keys(details_types))

But doing this generates an error:

%UndefinedFunctionError{arity: 1, function: :cast, message: nil, module: :assoc, reason: nil}, stack: [{:assoc, :cast, [%{"code" => "100", "id" => "saas"}]

Many thanks