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

Duplicate fields on type are currently allowed #1133

Closed
kdawgwilk opened this issue Dec 14, 2021 · 1 comment · Fixed by #1135
Closed

Duplicate fields on type are currently allowed #1133

kdawgwilk opened this issue Dec 14, 2021 · 1 comment · Fixed by #1135

Comments

@kdawgwilk
Copy link
Contributor

Environment

  • Elixir version (elixir -v): 1.12.3
  • Absinthe version (mix deps | grep absinthe): 1.6.6
  • Client Framework and version (Relay, Apollo, etc): N/A

Expected behavior

Absinthe fails to compile my schema and gives an error message indicating that the same field is being defined more than once on a type

Actual behavior

schema compiles without issue

Relevant Schema/Middleware Code

defmodule MySchema do
  use Absinthe.Schema

  query do
    field :foo, :string
    field :foo, :string
  end
end

This results in a malformed SDL file generated from the mix absinthe.schema.sdl task which is rejected by most tooling e.g. schema registries.

@kdawgwilk
Copy link
Contributor Author

This can commonly occur when sharing schema types between multiple graphs when using import_types and import_fields

maartenvanvliet added a commit to maartenvanvliet/absinthe that referenced this issue Dec 28, 2021
Fixes absinthe-graphql#1133
Also fixes absinthe-graphql#1049
as the schema's won't compile anymore, so the warning no longer happens
maartenvanvliet added a commit to maartenvanvliet/absinthe that referenced this issue Dec 28, 2021
Fixes absinthe-graphql#1133
Also fixes absinthe-graphql#1049
as the schema's won't compile anymore, so the warning no longer happens
benwilson512 pushed a commit that referenced this issue Jan 4, 2022
* 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
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

Successfully merging a pull request may close this issue.

1 participant