spec-first / connexion

Connexion is a modern Python web framework that makes spec-first and api-first development easy.
https://connexion.readthedocs.io/en/latest/
Apache License 2.0
4.5k stars 765 forks source link

connexion run --stub with resolvers not working ? #1286

Open lefeverd opened 4 years ago

lefeverd commented 4 years ago

Hello everyone,

Description

It seems that using the command connexion run with custom Resolvers doesn't work.

Expected behaviour

Stubbing the specification should work even when using a custom Resolver, the same way it works without :

connexion run examples/openapi3/helloworld/openapi/helloworld-api.yaml examples/openapi3/helloworld/ --stub -v

Actual behaviour

Currently, a 501 NOT IMPLEMENTED response is sent:

[dvd@dvd-fedora connexion]$ curl -v 'http://127.0.0.1:5000/v1.0/pets'
*   Trying 127.0.0.1:5000...
* Connected to 127.0.0.1 (127.0.0.1) port 5000 (#0)
> GET /v1.0/pets HTTP/1.1
> Host: 127.0.0.1:5000
> User-Agent: curl/7.69.1
> Accept: */*
> 
* Mark bundle as not supporting multiuse
* HTTP 1.0, assume close after body
< HTTP/1.0 501 NOT IMPLEMENTED
< Content-Type: application/problem+json
< Content-Length: 110
< Server: Werkzeug/1.0.1 Python/3.8.5
< Date: Sun, 30 Aug 2020 08:42:27 GMT
< 
{
  "detail": "Empty function name",
  "status": 501,
  "title": "Not Implemented",
  "type": "about:blank"
}
* Closing connection 0

Steps to reproduce

Run the restyresolver example with connexion run :

connexion run examples/openapi3/restyresolver/resty-api.yaml examples/openapi3/restyresolver/ --stub -v

Try to execute a request :

[dvd@dvd-fedora connexion]$ curl -v 'http://127.0.0.1:5000/v1.0/pets'

Additional info:

Output of the commands:

RobbeSneyders commented 1 year ago

The CLI only uses your specification and view functions. The application is instantiated with the default resolver. If we would want to enable different resolvers, we would have to add this as an option to the CLI.