def generate_parameters_validator(api_path, path_definition, parameters,
                                  context, **kwargs):
    """
    Generates a validator function to validate.

    - request.path against the path parameters.
    - request.query against the query parameters.
    - request.headers against the header parameters.
    - TODO: request.body against the body parameters.
    - TODO: request.formData against any form data.
    """
    # TODO: figure out how to merge this with the same code in response
    # validation.
    validators = ValidationDict()
    path_level_parameters = dereference_parameter_list(
        path_definition.get('parameters', []),
        context,
    )
    operation_level_parameters = dereference_parameter_list(
        parameters,
        context,
    )

    all_parameters = merge_parameter_lists(
        path_level_parameters,
        operation_level_parameters,
    )

    # PATH
    in_path_parameters = filter_parameters(all_parameters, in_=PATH)
    validators.add_validator(
        'path',
        chain_reduce_partial(
            attrgetter('path'),
            generate_path_parameters_validator(api_path, in_path_parameters, context),
        ),
    )

    # QUERY
    in_query_parameters = filter_parameters(all_parameters, in_=QUERY)
    validators.add_validator(
        'query',
        chain_reduce_partial(
            attrgetter('query_data'),
            functools.partial(
                validate_query_parameters,
                query_parameters=in_query_parameters,
                context=context,
            ),
        ),
    )

    # HEADERS
    in_header_parameters = filter_parameters(all_parameters, in_=HEADER)
    validators.add_validator(
        'headers',
        chain_reduce_partial(
            attrgetter('headers'),
            generate_header_validator(in_header_parameters, context),
        ),
    )

    # FORM_DATA
    # in_form_data_parameters = filter_parameters(all_parameters, in_=FORM_DATA)
    # validators.add_validator(
    #     'form_data',
    #     chain_reduce_partial(
    #         attrgetter('data'),
    #         generate_form_data_validator(in_form_data_parameters, context),
    #     )
    # )

    # REQUEST_BODY
    in_request_body_parameters = filter_parameters(all_parameters, in_=BODY)
    validators.add_validator(
        'request_body',
        chain_reduce_partial(
            attrgetter('data'),
            generate_request_body_validator(in_request_body_parameters, context),
        )
    )

    return generate_object_validator(field_validators=validators)
Generates a validator function to validate.

    - request.path against the path parameters.
    - request.query against the query parameters.
    - request.headers against the header parameters.
    - TODO: request.body against the body parameters.
    - TODO: request.formData against any form data.