opened
jvgutierrez
username_0
Function get_function_parameters from connexion/decorators/parameters.py changes its behavior from python 2.7 to python 3.5:

```python
def get_function_arguments(function):  # pragma: no cover
    """
    Returns the list of arguments of a function
    :type function: Callable
    :rtype: list[str]
    """
    if six.PY3:
        return list(inspect.signature(function).parameters)
    else:
        return inspect.getargspec(function).args
```

If the parameter function is a decorated function (i.e basicauth example) with parameters in python 2.7 the result is always an empty list while in python 3.5 the result is the list with the actual parameters of the decorated function.
get_function_arguments() behavior changes between python 2.7 and python 3.5
issue
created
jvgutierrez
username_0
This it's why I was misleaded to open #141 :(
comment
created
rafaelcaricio
username_1
Could you please provide an example of a function that have different behaviour so we can reproduce this situation?
comment
created
jvgutierrez
username_0
@username_1 Take your basicauth example (https://github.com/zalando/connexion/blob/master/examples/basicauth/app.py#L36). Modify /secret to receive one parameter. For instance:
```yaml
  /secret/{secret_id}:
    get:
      summary: Return secret string
      operationId: app.get_secret
      parameters:
        - in: path
          name: secret_id
          type: string
          required: true
      responses:
        200:
          description: secret response
          schema:
            type: string
```

And of course the controller to handle the new parameter:
```python
@requires_auth
def get_secret(secret_id: str) -> str:
    return 'This is a very secret string requiring authentication!'
```

This will only work in python 3, in python 2.7 get_secret will be always invoked without parameters
comment
created
rafaelcaricio
username_1
@username_0 I have been investigating this issue and seems like there it is a problem when you use the `functools.wraps` or nothing in your decorators. The `functools.wraps` does not pass the information about parameters of the original function to the decorated instance. This makes connexion fail to get the argument list defined in the original function.

A solution I recommend is to use the [`decorator`](https://github.com/micheles/decorator) package since [pass the information](http://stackoverflow.com/questions/3972290/how-can-i-get-the-argument-spec-on-a-decorated-function) about the defined argument list of the original function to the decorated instance.

I will update our example to use the `decorator` package and try to fit in our documentation an alert on that matter.
comment
closed
hjacobs
username_2
issue