absinthe-graphql/absinthe

Directives can be repeated even if they are not marked repeatable

kdawgwilk opened this issue · 1 comments

We likely will need to add a directive validation phase that ensures that a non-repeatable directive cannot be added more than once to a field

defmodule MyApp.MySchema do
  use Absinthe.Schema

  object :user do
    field :whole_name, :string, deprecate: "Use fullName instead please" do
      deprecate("Use fullName instead")
      ...
    end
  end
  ...
end

running mix absinthe.schema.sdl --schema MyApp.MySchema gives the following invalid schema

type User {
  wholeName: String @deprecated(reason: "Use fullName instead please") @deprecated(reason: "Use fullName instead")
  ...
}
...

@deprecated is not repeatable so this should not be allowed

There's a validation phase to check this. It's probably only present in the document pipeline and not in the schema pipeline.