How can i restrict a field type to the enum?

Hello everyone,
Given the following example:

object :car_type do
  field(:brand, :string)
  field(:color, :string)
end

enum :color do
  value :red, as: :r, description: "Color Red"
  value :green, as: :g, description: "Color Green"
end

Question:
How i can restrict the color from the car_type to the enum color or is this done automatically by absinthe?
Because i couldn’t find anything regarding this in the docs.

Expected results::
Absinthe to complain if the color in my mutation or query is not green or red.
Thanks in advance

Isn’t it like this?

field(:color, type: :color)

4 Likes

Thanks for the answer @kokolegorille