bitwalker / bitwalker/conform

`default: []` not working in umbrella release

Open
#156 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Elixir
Stars
378
Forks
59
PR merge metrics
No merged PRs in 30d

Description

**Version: 2.5.2**

I have umbrella release with multiple `*.schema.exs` files. When I define mapping key:
```
[
mappings: [
"message_broker.publishing": [
commented: false,
hidden: true,
datatype: [list: :binary],
default: [],
required: false,
env_var: "MESSAGE_BROKER_PUBLISHING_EVENTS"
]
```
then the resulting, merged schema file, after `mix release` contains:
```
[
mappings: [
"message_broker.publishing": [
commented: false,
datatype: [
list: :binary
],
env_var: "MESSAGE_BROKER_PUBLISHING_EVENTS",
hidden: false
]
```

I investigated the case and found out that this code might be the cause of the problem:
```
defp to_list(%Conform.Schema.Mapping{name: name} = mapping) do
props = mapping
|> Map.to_list
|> Keyword.delete(:__struct__)
|> Keyword.delete(:name)
|> Keyword.delete(:persist)
|> Enum.filter(fn
{_, ignore} when ignore in [nil, "", []] -> false
_ -> true
end)
{String.to_atom(name), props}
end
```
Precisely - the part with `Enum.filter` call.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.