Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default: [] not working in umbrella release #156

Open
artospaj opened this issue Jul 25, 2018 · 0 comments
Open

default: [] not working in umbrella release #156

artospaj opened this issue Jul 25, 2018 · 0 comments

Comments

@artospaj
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant