def _validate_param(rtype, fields):
    """ Ensure the sparse fields exists on the models """

    try:
        # raises ValueError if not found
        model = rtype_to_model(rtype)
        model_fields = model.all_fields
    except ValueError:
        raise InvalidQueryParams(**{
            'detail': 'The fields query param provided with a '
                      'field type of "%s" is unknown.' % rtype,
            'links': LINK,
            'parameter': PARAM,
        })

    for field in fields:
        if field not in model_fields:
            raise InvalidQueryParams(**{
                'detail': 'The fields query param "TYPE" of "%s" '
                          'is not possible. It does not have a field '
                          'by the name of "%s".' % (rtype, field),
                'links': LINK,
                'parameter': PARAM,
            })
Ensure the sparse fields exists on the models