absinthe-graphql / absinthe

The GraphQL toolkit for Elixir
http://absinthe-graphql.org
Other
4.28k stars 524 forks source link

warning: using map.field notation (without parentheses) to invoke function ... is deprecated #1324

Closed hez closed 3 months ago

hez commented 3 months ago

Environment

Expected behavior

We should be able to compile our code base without warnings. Normally I wouldn't open a ticket about a warning in a library but this shows up as a warning during the compilation of our code base not the absinthe library. We have warnings as errors and therefor right now cannot release with Elixir 1.17.

Actual behavior

warning: using map.field notation (without parentheses) to invoke function Absinthe.Type.BuiltIns.Directives.__absinthe_blueprint__() is deprecated, you must add parentheses instead: remote.function()
  (absinthe 1.7.6) lib/absinthe/phase/schema/directive_imports.ex:36: Absinthe.Phase.Schema.DirectiveImports.do_imports/3
  (absinthe 1.7.6) lib/absinthe/phase/schema/directive_imports.ex:18: Absinthe.Phase.Schema.DirectiveImports.handle_imports/2
  (absinthe 1.7.6) lib/absinthe/blueprint/transform.ex:16: anonymous fn/3 in Absinthe.Blueprint.Transform.prewalk/2
  (absinthe 1.7.6) lib/absinthe/blueprint/transform.ex:117: Absinthe.Blueprint.Transform.walk/4
  (elixir 1.17.0) lib/enum.ex:1829: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3

Relevant Schema/Middleware Code

Looks like there are a fair number of lines in the absinthe project that are offenders, from our project 8ish, but I am positive that is not all of em.

benwilson512 commented 3 months ago

Please check recent issue when submitting, this is fixed in main and a release will go out shortly.

Tangentially;

We have warnings as errors and therefor right now cannot release with Elixir 1.17.

This seems like a fine policy on code you control but seems very strange to apply to libraries.

hez commented 3 months ago

Please check recent issue when submitting, this is fixed in main and a release will go out shortly.

I had, this issue took a few days to hit submit and forgot to look again before hitting go. Sorry about that.

Tangentially;

We have warnings as errors and therefor right now cannot release with Elixir 1.17.

This seems like a fine policy on code you control but seems very strange to apply to libraries.

Yup, agreed. Except this does cause warnings which the compiler thinks belong to us. Pretty sure this is all from running macros.

rockneurotiko commented 3 months ago

It does when compiling the project, because the code that return the warning are in after compiles of Absinthe.Schema.

I guess we have to wait until the new release 😄

hubertlepicki commented 2 months ago

anyone knows if there's a way to suppress these warnings while the release is being worked on? At least in my project, I can't upgrade to 1.17.x as the compilation with --warnings-as-errors fails.

It's not compilation of "absinthe" dependency that fails the compilation, that would not happen with --warnings-as-errors, but one of my apps that's using Absinthe. I think it's coming from the schema.ex where Absinthe's macros kick in and compiler thinks the issue is with my code, while it's the library.

Is there a way that I am missing or we need to wait for absinthe release ?