You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This isn't really a bug per-se but a usability issue, and was entirely caused by my own mistake:
I suddenly found after a series of changes to my code that I was getting warnings like this:
warning: this clause cannot match because a previous clause at line 1 always matches
lib/myapp_web/schema/my_types.ex:1
It turns out I had mistakenly added duplicate fields to one of my schema. The only way I could track it down was by progressively commenting out bits of my schema until I isolated the warning.
Absinthe version (mix deps | grep absinthe):
* absinthe 1.6.0 (Hex package) (mix)
locked at 1.6.0 (absinthe) 99915841
* absinthe_plug 1.5.4 (Hex package) (mix)
locked at 1.5.4 (absinthe_plug) 80360cd8
Client Framework and version (Relay, Apollo, etc): N/A
Expected behavior
A warning or error of some sort that informed me that I had made a silly mistake!
Actual behavior
I receive several warnings like this:
warning: this clause cannot match because a previous clause at line 1 always matches
lib/myapp_web/schema/my_types.ex:1
The line number is always 1.
Relevant Schema/Middleware Code
Here's a minimal example that reproduces the behaviour:
object :my_object do
field :my_field, :string
field :my_field, :number
end
Of course this is a contrived example because you can clearly see the mistake when there are but two properties. If your object schema is larger (like mine is) then it's harder to see. It'd be great if some sort of warning and or error was triggered (with the appropriate line number, instead of just line 1).
The text was updated successfully, but these errors were encountered:
* Add unique field names validation
Fixes#1133
Also fixes#1049
as the schema's won't compile anymore, so the warning no longer happens
* Optimize duplicate?/3 check
* Add changelog entry
This isn't really a bug per-se but a usability issue, and was entirely caused by my own mistake:
I suddenly found after a series of changes to my code that I was getting warnings like this:
It turns out I had mistakenly added duplicate fields to one of my schema. The only way I could track it down was by progressively commenting out bits of my schema until I isolated the warning.
Environment
Elixir version (elixir -v):
Erlang/OTP 23 [erts-11.1.8] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe]
Absinthe version (mix deps | grep absinthe):
* absinthe 1.6.0 (Hex package) (mix)
locked at 1.6.0 (absinthe) 99915841
* absinthe_plug 1.5.4 (Hex package) (mix)
locked at 1.5.4 (absinthe_plug) 80360cd8
Client Framework and version (Relay, Apollo, etc): N/A
Expected behavior
A warning or error of some sort that informed me that I had made a silly mistake!
Actual behavior
I receive several warnings like this:
The line number is always
1
.Relevant Schema/Middleware Code
Here's a minimal example that reproduces the behaviour:
Of course this is a contrived example because you can clearly see the mistake when there are but two properties. If your
object
schema is larger (like mine is) then it's harder to see. It'd be great if some sort of warning and or error was triggered (with the appropriate line number, instead of just line1
).The text was updated successfully, but these errors were encountered: