   def generate_struct(%Type{} = t, _parent_mod) do
     IO.puts "Ignore simple type #{t.name}"
     []
+  end
+
+  def struct_name(name, parent_mod) do
+    Atom.to_string(parent_mod) <>
+      "." <> (name |> String.capitalize)
+    |> String.to_atom
   end
 
   def extract_field(%Field{name: n, type: t} = f) do

    type_list = fs
    |> Enum.map(fn f -> {f.name, f.type} end)
    |> Enum.map(fn {n, t} -> quote do unquote(n) :: unquote(t) end end)
    mod_name = Atom.to_string(parent_mod) <>
      "." <> (t.name |> String.capitalize)
    |> String.to_atom
    quote do
      defmodule unquote(mod_name) do
        defstruct unquote(field_list)

    value = case f do
      %Field{multiple: true} -> []
      %Field{default: nil} -> nil
      %Field{default: "true"} when type == :boolean -> true
      %Field{default: "false"} when type == :boolean -> false
      %Field{default: d} ->
        if type in [:integer, :non_neg_integer, :pos_integer] do
          {num, <<>>} = Integer.parse(d, 10)
