GraphQL - allow only specific values ​​for input types

I am using stone [graphql][1]to create the GraphQL API.

When defining input, for example,

Inputs::BranchInput = GraphQL::InputObjectType.define do
  name 'BranchInput'

  argument :scope,                      types.String
end

An argument scopeis actually an enumeration field that will accept either smallor big. How can I determine this in the input, that this argument will only take these two values? Is it possible to show this in the documents when they are generated, so that the user interface developers also understand this?

When using Grape to create a REST API, I would usually use a parameter valuesto define something like this.

+4
source share

Source: https://habr.com/ru/post/1696074/


All Articles