class GraphQL::Schema::Validator::LengthValidator

Use this to enforce a .length restriction on incoming values. It works for both Strings and Lists.

Examples

Example: Allow no more than 10 IDs

argument :ids, [ID], required: true, validates: { length: { maximum: 10 } }

Example: Require three selections

argument :ice_cream_preferences, [ICE_CREAM_FLAVOR], required: true, validates: { length: { is: 3 } }