vic / params

Easy parameters validation/casting with Ecto.Schema, akin to Rails' strong parameters.
http://hex.pm/packages/params
Apache License 2.0
364 stars 47 forks source link

Fix warnings #43

Closed tiagopog closed 10 months ago

tiagopog commented 1 year ago

Fix the following compile-time warnings in Elixir 1.14.3:

==> params
Compiling 4 files (.ex)
warning: Ecto.Changeset.cast/3 defined in application :ecto is used by the current application but the current application does not depend on :ecto. To fix this, you must do one of:

  1. If :ecto is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :ecto is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :ecto, you may optionally skip this warning by adding [xref: [exclude: [Ecto.Changeset]]] to your "def project" in mix.exs

  lib/params.ex:144: Params.changeset/2

warning: Ecto.Changeset.cast_assoc/3 defined in application :ecto is used by the current application but the current application does not depend on :ecto. To fix this, you must do one of:

  1. If :ecto is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :ecto is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :ecto, you may optionally skip this warning by adding [xref: [exclude: [Ecto.Changeset]]] to your "def project" in mix.exs

  lib/params.ex:185: Params.cast_relations/3

warning: Ecto.Changeset.cast_embed/3 defined in application :ecto is used by the current application but the current application does not depend on :ecto. To fix this, you must do one of:

  1. If :ecto is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :ecto is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :ecto, you may optionally skip this warning by adding [xref: [exclude: [Ecto.Changeset]]] to your "def project" in mix.exs

  lib/params.ex:186: Params.cast_relations/3

warning: Ecto.Changeset.change/1 defined in application :ecto is used by the current application but the current application does not depend on :ecto. To fix this, you must do one of:

  1. If :ecto is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :ecto is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :ecto, you may optionally skip this warning by adding [xref: [exclude: [Ecto.Changeset]]] to your "def project" in mix.exs

Invalid call found at 2 locations:
  lib/params.ex:161: Params.change/1
Warning:   lib/params.ex:165: Params.change/1

warning: Ecto.Changeset.validate_required/2 defined in application :ecto is used by the current application but the current application does not depend on :ecto. To fix this, you must do one of:

  1. If :ecto is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :ecto is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :ecto, you may optionally skip this warning by adding [xref: [exclude: [Ecto.Changeset]]] to your "def project" in mix.exs

  lib/params.ex:145: Params.changeset/2

warning: incompatible types:

    map() !~ atom()

in expression:

    # lib/params.ex:130
    module.__changeset__

where "module" was given the type atom() in:

    # lib/params.ex:128
    is_atom(module)

where "module" was given the type map() (due to calling var.field) in:

    # lib/params.ex:130
    module.__changeset__

HINT: "var.field" (without parentheses) implies "var" is a map() while "var.fun()" (with parentheses) implies "var" is an atom()

Conflict found at
  lib/params.ex:130: Params.optional/1
vheathen commented 10 months ago

@vic Hi! May I ask to have a look at this? Thanks a lot in advance!