Currently strukt typing embeds_one :foo, Foo's type as Foo.t(), embeds_many :foos, Foo as [Foo.t()]:
|
|> Enum.map(fn |
|
{name, %{type: :embeds_one, value_type: type}} -> |
|
{name, compose_call(type, :t, [])} |
|
|
|
{name, %{type: :embeds_many, value_type: type}} -> |
|
{name, List.wrap(compose_call(type, :t, []))} |
it couldn't handle situations like
:foo field could be null which type should be Foo.t() | nil,
:foos could be nil, but element couldn't: [Foo.t()] | nil
:foos could be nil, element's could be nil too: nil | [Foo.t() | nil]
any idea for handle these cases?
Currently strukt typing
embeds_one :foo, Foo's type asFoo.t(),embeds_many :foos, Fooas[Foo.t()]:strukt/lib/typespec.ex
Lines 72 to 77 in 2b6c643
it couldn't handle situations like
:foofield could be null which type should beFoo.t() | nil,:fooscould be nil, but element couldn't:[Foo.t()] | nil:fooscould be nil, element's could be nil too:nil | [Foo.t() | nil]any idea for handle these cases?