process method

  1. @override
dynamic process(
  1. Request request,
  2. ControllerMethodParam methodParam
)
override

Implementation

@override
process(Request request, ControllerMethodParam methodParam) {
  final paramName = name ?? methodParam.name;
  final value = request.query[paramName] ?? methodParam.defaultValue;
  if (!methodParam.optional && value == null) {
    throw RequestValidationError.query(
        EzValidator.globalLocale.required(paramName));
  }

  final parsedValue = _parseValue(value, methodParam.type);
  if (parsedValue == null) {
    throw RequestValidationError.query(
        EzValidator.globalLocale.isTypeOf('${methodParam.type}', paramName));
  }
  return parsedValue;
}